Then click the “Create badge” button, So name the badge whatever you like. Then upload the image you want for your badge also add a description. and check if the badge is enabled is toggled on. If it is then hit the “Create Badge” button at the bottom of the page
once your in the badge page hover over your badge and click the 3 dots click “copy asset ID”
now that your badge is created lets go back in studio.
add a script in Server Script Service and write
local badgeService = game:GetService("BadgeService") --calls badge service
local badgeID = 0 --badge id here
game.Players.PlayerAdded:Connect(function(player)
task.wait(.5) --waits to give badge
badgeService:AwardBadge(player.UserId, badgeID) --awards badge
end)
—now test it out and there you go you now have a working welcome badge for your roblox game
You might want to add a check to see if the player already has the badge so it doesn’t throw a warning in the output.
local badgeService = game:GetService("BadgeService") --calls upon badge service
local badgeID = 0 --your badge id here
game.Players.PlayerAdded:Connect(function(player)
task.wait(.5) --waits a little to give the badge (don't use wait() it's equally inefficient and memory consuming)
if badgeService:UserHasBadgeAsync(player.UserId,badgeID) then
badgeService:AwardBadge(player.UserId,badgeID) --awards the badge
end
end)
I was gonna do a task.wait but I thought “wait()” was more simple and I edited the post to match your script but thanks for the feedback (also I dont thing the if statement works I tried it)
game.Players.PlayerAdded:Connect(function(player)
task.wait(.5) --waits a little to give the badge (don't use wait() it's equally inefficient and memory consuming)
if not badgeService:UserHasBadgeAsync(player.UserId,badgeID) then
badgeService:AwardBadge(player.UserId,badgeID) --awards the badge
end
end)
since you should be checking if the player doesn’t have the badge