local player = game.Players.LocalPlayer
local leaderboard = player:WaitForChild("leaderstats")
local button = script.Parent
local price = button:WaitForChild("Price")
local item = button:WaitForChild("ItemName")
local rs = game:GetService("ReplicatedStorage")
button.MouseButton1Click:Connect(function()
if leaderboard.Coins.Value>=price.Value then
leaderboard.Coins.Value = leaderboard
Coins.Value - price.Value
local item = rs:WaitForChild(item.Value)
item:Clone().Parent = player.StarterGear
item:Clone().Parent = player.Backpack
end
end)
while wait()do
button.Text = item.Value.."-"..price.Value
end
I made the script above but i want to allow the players to buy only 1 of each item,(example: not like 10 bloxy cola but only allow them to buy 1 bloxy cola.) how do i do this?

1 comment
no rempve the top part from line 4 to 7 then add in a if statement on line 16, and say if a == 1 then return end, else if leaderboard blah blah blah and then at the end where u clone the item, do A = 1 or A = A + 1 (Please accept answer xD)