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

Badge awards gear, what's wrong with this?

Asked by 11 years ago

I want to make it so if you have a badge, you get a gear. What's wrong with this! It all checks out in my knowledge so I have no idea...

1local BadgeService = Game:GetService('BadgeService')
2 
3game.Players.PlayerAdded:connect(function(player)
4if BadgeService:UserHasBadge(player.userId, 158464344) then
5repeat wait() until player.StarterGear
6game.Lighting["TesterBike"]:Clone().Parent = player.StarterGear
7end end)

There's an IntValue named GamePassId as a child to this. There is also an asset loader with IntValue's of the awardable gear.

1 answer

Log in to vote
2
Answered by
Gamenew09 180
11 years ago

The function you call to check if the player has the badge is using PlayerHasPass which doesn't exist in the BadgeService, you need to use UserHasBadge.

Change line 4 to: if BadgeService:UserHasBadge(player.userId, BadgeIdObject.Value) then

0
I've since changed the script slightly but based it around your answer. It still doesn't work. I updated the origional question with the new slightly changed script. Michael007800 144 — 11y
0
Wait, no need. I'm just an idiot. :P It works perfectly! Michael007800 144 — 11y
Ad

Answer this question