So everything is fine just when it says Owned, you can buy the weapon more than once, how do I make it to where you can only buy it once?
local player = game.Players.LocalPlayer local rs = game.ReplicatedStorage local tool = rs.HyperlaserGun local stats = player.leaderstats local button = script.Parent price = 100 script.Parent.MouseButton1Click:Connect(function() if stats.Cash.Value >= price then button.Text = 'Owned' stats.Cash.Value = stats.Cash.Value - price local clone = tool:Clone() clone.Parent = player.Backpack local cloneforstartergear = tool:Clone() cloneforstartergear.Parent = player.StarterGear else button.Text = 'Failed' wait(1) button.Text = 'Buy' end end)
I know I am late but you can just disable the script after the whole script
So, to solve your problem you want to check if they don't already own the item . If they don't they will be able to buy it so the line before this :
if stats.Cash.Value >= price then button.Text = 'Owned'
add this :
if player.Backpack:FindFirstChild(tool) == nil and player.StarterGear:FindFirstChild(tool) == nil then ... end
And if they are buying something else and want to equip you would want to check the datastore and see if they own it. Hope this helps!