hello robloxians i was wondering how to put my badge in the game because while following tthe tutorial on the roblox devoper stuff it doesnt pop up where to put it in
that is the badge
hello robloxians i was wondering how to put my badge in the game because while following tthe tutorial on the roblox devoper stuff it doesnt pop up where to put it in
Hey man, I believe that you need to script that in game. That isn’t really a building related thing. #help-and-feedback:scripting-support Also you spelled your title wrong, just letting you know.
im sorry i thought this was building related thank you
If you just want to give players a badge when they join, you could make a function to do it. Something like this…but you may want to add more parameters or a check for the badge but as a start…Obviously you’d need to replace the BadgeID with your BadgeID#.
BadgeID= 0000000000
function onPlayerEntered(player)
for _,a in pairs(game.Players:GetChildren()) do
if a then
game:GetService("BadgeService"):AwardBadge(a.userId,BadgeID)
end
end
end
game.Players.ChildAdded:Connect(onPlayerEntered)
thank you so much sorry for the inconvience
You’ll need to use BadgeService:AwardBadge and BadgeService:UserHasBadgeAsync to do this.
Here’s a basic example.
local BadgeService = game:GetService('BadgeService')
local Players = game:GetServices('Players')
local id = 00000000 -- replace the 0's with your badge id
Players.PlayerAdded:Connect(function(player)
if not BadgeService:UserHasBadgeAsync(player.UserId, id) then
BadgeService:AwardBadge(player.UserId, id)
end
end)
what do i place the script in if it doesnt bother u to ask
You should place that inside ServerScriptService.
Ideally in ServerScriptService
ok thank you both now when a new player joins they will get this notification and the badge?
They should receive the badge.