Weapon GUI Badge access not working?
I've been trying my best to make a GUI with weapon equip options. However, the weapons in the game must be found via Badge collection. So once the badge for the weapon is found, you should be able to click on the GUI button and equip it to your startergear, if it isn't found then the equip button should be disabled. I'm confident I'm just following the wrong guidelines to make it, any options for this?
02 | badge = game:GetService( "BadgeService" ) |
03 | player = script.Parent.Parent.Parent.Parent.Parent |
05 | function find(userid, badgeid) |
06 | if game:GetService( "BadgeService" ):UserHasBadge(userid, badgeid) then |
07 | clone = game.Lighting.GravityCoil:clone() |
08 | clone.Parent = player.StarterGear |
12 | function MouseClick(hit) |
13 | if (hit.Parent:FindFirstChild( "Humanoid" ) ~ = nil ) then |
14 | local p = game.Players:GetPlayerFromCharacter(hit.Parent) |
16 | if (find(p.userId, badgeholder.Value)) then |
17 | clone = game.Lighting.GravityCoil:clone() |
18 | clone.Parent = player.StarterGear |
19 | elseif (find(p.userId, badgeholder.Value) = = false ) then |
20 | hit.Parent.MouseButton 1 Click:remove() |
23 | script.Parent.MouseButton 1 Click:connect(MouseClick) |