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

How to see if a player has a badge?

Asked by 8 years ago

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.

0
Your asset id stored in `vipItem` is for a GamePass not a Badge: https://www.roblox.com/VIP-item?id=346341127 BlackJPI 2658 — 8y
0
This is a script from a door only for VIPs. It worked, but when I made it a notification, it didn't work. danclay 0 — 8y
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 NinjoOnline 1146 — 8y

1 answer

Log in to vote
0
Answered by
Prioxis 673 Moderation Voter
8 years ago
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

Ad

Answer this question