I tried several ways to stop this script from allowing you to buy the items more than once but nothing is working.
player = script.Parent.Parent.Parent.Parent.Parent
money = player.leaderstats.Credits
price = script.Parent.Price.Value
tool = game.ReplicatedStorage:findFirstChild("TG45")
function buy()
if money.Value >= price then
money.Value = money.Value - price
local a = tool:clone()
a.Parent = player.Backpack
player.GearStats.TG45.Value = true
end
end
script.Parent.MouseButton1Down:connect(buy)

2 comments
The script dosen't work when I try this
whats the error?