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?
My sad attempt ~
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)
