debounce = false
script.Parent.MouseEnter:connect(function(enter)
script.Parent.BorderSizePixel = 3
script.Parent.MouseButton1Click:connect(function(onClick)
for i, player in pairs(game.Players:GetChildren()) do
if player.Points.Value >= 100 then
player.Points.Value = player.Points.Value - 100
if debounce == false then
debounce = true
local ks = game:GetService("ReplicatedStorage").Swords.KnightsSword
ks:Clone().Parent = player.Backpack
ks:Clone().Parent = player.StarterGear
debounce = false
end
end
end
end)
end)
I have tried many different ways to stop this but nothing works. I have it set to if the player has 100 or more points then give them an item, but it dosent just give them the item and takes 100 away, sometimes it gives you 2 or 3 of the item and charging 200, or 300. Is there a way to prevent that so it the sword is only awarded ONCE and they cant pruchase another for 10 seconds.

1 comment
Why are you getting a list of players in a button event? This is not necessary.