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

Local Badge script error?

Asked by 10 years ago

I've been trying my best to make a GUI with weapon equip options. However, the weapons in the game should only be accessed if the player has the certain badge collected. So once the badge for the weapon is found, you should be able to click on the GUI button and equip it to your inventory, 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?

The following script doesn't work properly for some odd reason:

01local ID = 158694379
02local badge = game:GetService("BadgeService")
03local player = game.Players.LocalPlayer
04 
05function find(userid, badgeid)
06    if badge :UserHasBadge(userid, badgeid) then
07        local clone = game.ReplicatedStorage.GravityCoil:clone()
08        local clone2 = game.ReplicatedStorage.GravityCoil:clone()
09        clone.Parent = player.Backpack
10        clone2.Parent = player.StarterGear
11    else
12        script.Parent.MouseButton1Click:Destroy()
13        --script.Parent.BackgroundColor3 = Color3.New(.5, .5, .5)
14    end
15end
16 
17script.Parent.MouseButton1Click:connect(function() find(player.userId, ID) end)

Answer this question