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

How to see if a player has a badge?

I am attempting for the game to say if a player has a donate pass in a GUI. Here is what I have:

vipItem = 346341127
player = game.Players.LocalPlayer
if game:GetService("BadgeService"):UserHasBadge(player.UserId, vipItem) then
	script.Parent.owns1 = game.Players.LocalPlayer.Name.. "has not donated!"
else
	script.Parent.owns1 = game.Players.LocalPlayer.Name.. "has donated!"
end

For some reason, it does not work.

3 comments

0

Your asset id stored in vipItem is for a GamePass not a Badge: https://www.roblox.com/VIP-item?id=346341127

0

This is a script from a door only for VIPs. It worked, but when I made it a notification, it didn't work.

0

I'm confused.... You said it was for a badge in the title, but in the question you say if they have donate pass? And then you have it as a VIP pass, instead of donate pass? Can you please explain a little more. If you change the id to a badge, it will work, but if you want to check if they have a pass you can use PlayerOwnsAsset

1 answer

✓ Accepted answer
vipItem = 346341127
player = game.Players.LocalPlayer
if game:GetService("BadgeService"):UserHasBadge(player.UserId, vipItem) then
    script.Parent.owns1 = game.Players.LocalPlayer.Name.. " has donated!"
else
    script.Parent.owns1 = game.Players.LocalPlayer.Name.. " has not donated!"
end

there wasn't anything wrong you just had it backwards e.e you checked if they had it and if they did you made it seem like they didn't

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