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

How would you check if a player has a certain badge?

Asked by 5 years ago
Edited 5 years ago
local badge = game:GetService("BadgeService")
local id = id_here

game.Players.PlayerAdded:connect(function(plr)
if plr.UserId == your_userid then
print("The owner joined! Awarding badges now!")
for i, p in pairs(game.Players:GetPlayers()) do
if badge:UserHasBadgeAsync(p.UserId, id) then
print(p.Name.." has the met owner badge!")
else
badge:AwardBadge(p.UserId, id)
end
end
end
end)

When I join a game it is supposed to award players a badge, but it doesnt. I checked the developer console > server and saw warns showing - Player already has this badge : BADGE_ID_HERE . But in the script it shows that it checks if the player has that certain badge or not, if not it will award the player that badge. What am I doing wrong???

0
hmmm are you sure this isnt working? should work starmaq 1290 — 5y
0
well idk man. it sometimes work and then doesnt, when it doesnt work the other lines of code after line 15 gets all bugged and fails. man this is just weird xXKillerMurderarXx 59 — 5y

Answer this question