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

Weapon GUI Badge access not working?

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 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?

ID = 158694379
badge = game:GetService("BadgeService")
player = script.Parent.Parent.Parent.Parent.Parent

function find(userid, badgeid)
if game:GetService("BadgeService"):UserHasBadge(userid, badgeid) then
    clone = game.Lighting.GravityCoil:clone()
    clone.Parent = player.StarterGear
    end
end

function MouseClick(hit)
    if (hit.Parent:FindFirstChild("Humanoid") ~= nil) then
        local p = game.Players:GetPlayerFromCharacter(hit.Parent)
        if (p ~= nil) then
            if (find(p.userId, badgeholder.Value)) then
                clone = game.Lighting.GravityCoil:clone()
                clone.Parent = player.StarterGear
        elseif (find(p.userId, badgeholder.Value) == false) then
            hit.Parent.MouseButton1Click:remove()
            end
end
script.Parent.MouseButton1Click:connect(MouseClick)

Answer this question