Roblox badge script

Give players a badge for joining, finishing a stage or finding a secret — a complete BadgeService script with the ownership check.

ScriptUpdated November 2, 2026

Where to put it

Script — Inside the part (Workspace > BadgePart > Script). It runs on the server, so players can't change what it does.

  1. Create the badge on the Creator Hub: your game → Engagement (or Associated Items) → Badges → Create a Badge. Roblox gives a few badges per day free; check the Creator Hub for the current cost after that.
  2. Copy the badge ID, put this Script inside the part players must touch, and paste the ID.

The script

Inside the part (Workspace > BadgePart > Script)
local Players = game:GetService("Players")
local BadgeService = game:GetService("BadgeService")

local BADGE_ID = 0 -- your badge ID
local part = script.Parent
local awarded = {}

part.Touched:Connect(function(hit)
	local player = Players:GetPlayerFromCharacter(hit.Parent)
	if not player or awarded[player] then return end
	awarded[player] = true

	local ok, hasBadge = pcall(function()
		return BadgeService:UserHasBadgeAsync(player.UserId, BADGE_ID)
	end)
	if ok and not hasBadge then
		local awardedOk, err = pcall(function()
			BadgeService:AwardBadgeAsync(player.UserId, BADGE_ID)
		end)
		if not awardedOk then
			warn("Badge award failed:", err)
			awarded[player] = nil
		end
	end
end)

Players.PlayerRemoving:Connect(function(player)
	awarded[player] = nil
end)

How it works

  • UserHasBadgeAsync avoids calling Roblox again for players who already have the badge.
  • Both calls are web requests, so they are wrapped in pcall.
  • awarded stops one touch from sending several requests.

Variations

Welcome badge on join

Put this in ServerScriptService instead of a part.

Players.PlayerAdded:Connect(function(player)
	pcall(function()
		if not BadgeService:UserHasBadgeAsync(player.UserId, BADGE_ID) then
			BadgeService:AwardBadgeAsync(player.UserId, BADGE_ID)
		end
	end)
end)

Common mistakes

  • Awarding from a LocalScript — BadgeService awards work only on the server.
  • Using a badge from another game: the badge must belong to the game it's awarded in.
  • Expecting badges in Studio tests to show on your profile — test in the live game.

FAQ

Why isn't my Roblox badge being awarded?

Check the script is a server Script, the badge ID is right and belongs to this game, the badge is enabled, and look in Output for errors from AwardBadgeAsync.

Do Roblox badges cost Robux?

Roblox allows a small number of free badge creations per day; after that it charges Robux. The Creator Hub shows the current price when you create one.

Keep reading