Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help at giving players badge whenever i am at the server. (?)

Asked by 7 years ago

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)

Answer this question