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 10 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...

local BadgeService = Game:GetService('BadgeService')

game.Players.PlayerAdded:connect(function(player)
if BadgeService:UserHasBadge(player.userId, 158464344) then
repeat wait() until player.StarterGear
game.Lighting["TesterBike"]:Clone().Parent = player.StarterGear
end 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
10 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 — 10y
0
Wait, no need. I'm just an idiot. :P It works perfectly! Michael007800 144 — 10y
Ad

Answer this question