I need help fixing my script that when clicked on a part buys pants with at leader stat named money and equips it to their character, help would be largely appreciated.
local pants = script.Parent.Parent.Parent.Char.Pants
Money = player.leaderstats.Money
script.Parent.ClickDetector.MouseClick:connect(function(player)
if player.Character ~= nil and Money.value = >100 then -- (100 is cost)
if player.Character:FindFirstChild("Pants") then
Money.value = -100
player.Character["Pants"]:remove()
pants:Clone().Parent = player.Character
else
pants:Clone().Parent = player.Character
end
end
end)
