Badges – Special Game Awards
Badges – Special Game Awards
Badges let you create special awards for players who do something exceptional within your game. A badge might be awarded when a player:
- Collects 100 gold stars.
- Jumps across a challenging series of platforms over a poison swamp.
- Finds all 7 keys to unlock the kingdoms of Earth, Air, Lava, Ocean, Light, Shadow, and Dreams.
Creating a Badge
It costs 100 to create a badge. To begin:
- Open the Game Explorer from the View tab in Roblox Studio.
- Right-click the Badges item and select Create Badge. This will open a new view with input fields for creating a badge.
Create an Icon
Badge icons should be designed using a template of 150×150 pixels or larger, as follows:
- In an image editing application, design a circular badge. The final icon will be trimmed/cropped into a circular image, so you shouldn’t include important details outside the circular boundaries.
- Save the badge image in .jpg, .gif, .png, .tga, or .bmp format.
Upload the Badge
The next step in the creation process is uploading the badge.
- Back on the Roblox website, click the small button next to Find your image.
- Find the badge image on your computer and confirm that you’d like to upload it.
- Type in a name and description for the badge. It’s a good idea to describe how the badge can be earned so players have a specific goal to reach for.
- Click Preview, review the details for the badge, and purchase when you’re ready. Once the purchase is complete, the badge will appear in the Game Badges section of the game’s main page.
Once you purchase a badge, it will be added to the Badges tree of the Game Explorer window. Note that you may need to click the refresh button in the top-right corner of the window to see a newly purchased badge.
To edit a badge, right-click it and select Configure. On the configuration page, you can edit the icon, badge name, and description. You can also toggle whether the badge is active with the Item is Active switch at the bottom of the page.
Scripting for Badges
To take full advantage of badges, you’ll need to use scripting. Here are some common examples:
Awarding a Badge
In the following script, the
awardBadge() function can be called whenever it fits your game design, for instance when a player touches the final platform of a challenging jumping sequence. Using
BadgeService functions, it checks if the player already owns the badge and, if not, awards it using
local BadgeService = game:GetService("BadgeService") local Players = game:GetService("Players") local badgeID = 0000000 -- Change this to your badge ID local function awardBadge() local player = Players.LocalPlayer local hasBadge = false -- Check if the player already has the badge local success, message = pcall(function() hasBadge = BadgeService:UserHasBadgeAsync(player.UserId, badgeID) end) -- If there's an error, issue a warning and exit the function if not success then warn("Error while checking if player has badge: " .. tostring(message)) return end if hasBadge == false then BadgeService:AwardBadge(player.UserId, badgeID) end end
Checking Earned Badges
The following script waits for any player to enter the game and checks if they own a specific badge. This is useful for creating a
articles/Collision Filtering Team Doors|restricted area or
articles/Teleporting Between Places|teleporter that only works if a player owns a special badge.
local BadgeService = game:GetService("BadgeService") local Players = game:GetService("Players") local badgeID = 0000000 -- Change this to your badge ID local function onPlayerAdded(player) local hasBadge = false -- Check if the player has the badge local success, message = pcall(function() hasBadge = BadgeService:UserHasBadgeAsync(player.UserId, badgeID) end) -- If there's an error, issue a warning and exit the function if not success then warn("Error while checking if player has badge: " .. tostring(message)) return end if hasBadge == true then -- Assign this player a property/indicator that they own the badge -- end end -- Connect 'PlayerAdded' events to the 'onPlayerAdded()' function Players.PlayerAdded:Connect(onPlayerAdded)