Script:
script.Parent.MouseButton1Down:Connect(function()
if game.Players.LocalPlayer.leaderstats.Cash.Value >= 3 then
local pistol = game.ReplicatedStorage.Pistol:Clone()
pistol.Parent = game.Players.LocalPlayer.Backpack
end
script.Parent.num.Value = script.Parent.num.Value +1
if script.Parent.num.Value ~= 1 and game.Players.LocalPlayer.leaderstats.Cash.Value < 3 then
game.Players.LocalPlayer.Backpack.Pistol:Destroy()
script.Parent.Text = "You already own that!"
wait(0.5)
script.Parent.Text = "Pistol"
end
end)
So it's like a buying system, if your cash value is more than 3 then you can buy it, also, if you already have one Pistol in your inventory it will not give you another one. But it keeps giving me a pistol even though I already have one in my inventory.
pls help

2 comments
right after the button1down add if num.Value == not 1 then...
Doesn't work