Im making a Gui shop, inside this shop you can buy tools. I want to make it soo it doesn't give the tool if the player already has it in his inventory. I tried looking for an answer but i couldn't find one.
Here's the script :
player = script.Parent.Parent.Parent.Parent.Parent.Parent
money = player.leaderstats.Cash
price = 100
tool = game.Lighting:findFirstChild("Bigger")
function buy()
if money.Value >= price then
money.Value = money.Value - price
local tool1 = tool:clone()
tool1.Parent = player.Backpack
local tool2 = tool:clone()
tool2.Parent = player.StarterGear
end
end
script.Parent.MouseButton1Down:connect(buy) ```