local debounce = false local moneybounce = false game.ReplicatedStorage.place1event.OnServerEvent:Connect(function(player) if player.leaderstats.Money.Value >= 5 then if not debounce then local char = player.Character.Humanoid debounce = true if not moneybounce then moneybounce = true player.leaderstats.Money.Value = player.leaderstats.Money.Value - 5 moneybounce = false end char.WalkSpeed = char.WalkSpeed + 5 print("Purchase Successful!") debounce = false end else print("Too Poor!") end end)
after money bounce = true and debounce = true add a wait(time in here) that way they cant click it again the reason it takes all the money is because the function runs several times so i would do
local debounce = false local moneybounce = false game.ReplicatedStorage.place1event.OnServerEvent:Connect(function(player) if player.leaderstats.Money.Value >= 5 then if not debounce then local char = player.Character.Humanoid debounce = true wait(1) if not moneybounce then moneybounce = true wait(1) player.leaderstats.Money.Value = player.leaderstats.Money.Value - 5 moneybounce = false end char.WalkSpeed = char.WalkSpeed + 5 print("Purchase Successful!") debounce = false end else print("Too Poor!") end end)
You should add a
wait(1)
after the money deduction part. The moneybounce is useless unless there's a wait.