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

Badge awards gear, what's wrong with this?

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

✓ Accepted answer

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

2 comments

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.

0

Wait, no need. I'm just an idiot. :P It works perfectly!

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