Badges or badges are rewards that players can get for special services within the play, for example if they find a secret place, spend a certain amount of time in the game, reach a maximum level or just because they enter the game. In this article you will learn how you can create a badge and give it to players.
How to Create a Badge
- First of all, you should prepare an image in a graphic editor with a size of 512 x 512 px for the badge. It is important to note that the square image will be cropped at the corners.
2. After that, go to the developer section of roblox (in the screenshots of the new interface) and select the map for which you want to create a badge.
3. Go to the tab Associated Items – Badges and click Create a Badge
4. Load the prepared image, enter the name and description for the badge, and then click Create Badge
5. After creating a need to wait for some time for that the image has been downloaded to the server and you saw how your badge will look like. If all is well click on it LKM.
6. In the address bar of the browser copy the id badge
7. Then we open our favorite Create and press Edit button on the card, for which we have made the badge. Wait until Roblox Studio opens.
8. Place the usual block in the place where you want the users to get the badge. You can, for example, make the block invisible and make users search for badges.
9. Add Script to the block and write the following code in it (replacing zeros with the id of the badge you created)
local badgeservice = game:GetService(“BadgeService”)
local id = 000000000
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
10. Publish changes in Roblox File – Publish to Roblox
11. Go into the game and get on the block. Congratulations, you got your badge!