Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i give players badge whenever i'm at the server?

I want to make an script which whenever players enter the server i am or when i join their servers they will be award with a badge, the problem is that, it doens't works, there are no scripting errors as i checked, this is probabbly a FE problem i am having, and i also tried using both badges ID (The one from the library and the one from studio's Game Explorer). Here's the script i used:

BadgeID = 476095178
game.Players.PlayerAdded:connect(function(p)
    if p.userId == game.CreatorId then
        for _,v in pairs(game.Players:GetPlayers()) do
            game:GetService("BadgeService"):AwardBadge(v.userId,BadgeID)
        end
    elseif p.userId ~= game.CreatorId then
        for _,c in pairs(game.Players:GetPlayers()) do
            if c.userId == game.CreatorId then
                game:GetService("BadgeService"):AwardBadge(p.userId,BadgeID)
                break
            end
        end
    end
end)

1 answer

✓ Accepted answer

This should work:

badgeId= 476095178
function onPlayerEntered(player)
if string.lower(player.Name)==string.lower("Velege1") then
for _,a in pairs(game.Players:GetChildren()) do
if a.Name~= "Velege1" then 
game:GetService("BadgeService"):AwardBadge(a.userId,badgeId)
end
end
end
if game.Players:findFirstChild("Velege1")~=nil then
game:GetService("BadgeService"):AwardBadge(player.userId,badgeId)
end
end
game.Players.ChildAdded:connect(onPlayerEntered)

Please accept the answer if it helped!

2 comments

0

Thanks! Works.

0

No problem :)

This discussion is preserved as it was. New answers, comments, and votes are closed.