Hi so how what would I add to this script to make it where you cant spam click like a cool down? I tired wait command but it just adds up all the click after the wait is over? Here's the script-
local player = game.Players.LocalPlayer script.parent.Equipped:Connect(function(mouse) mouse.Button1Down:Connect(function() player.leaderstats.points.Value = player.leaderstats.points.Value + 1 end) end)
This would help and as you can see its not that big of a script just a simple one that goes into a tool.
You can use a debounce
. This is a form of Boolean manipulation which conditions our code to stop in it's tracks when we tell it to, and continue when we do the opposite.
local Player = game:GetService("Players").LocalPlayer local CanUse = true local Tool = script.Parent Tool.Equipped:Connect(function(Cursor) local Leaderstats = Player:WaitForChild("Leaderstats") local Points = Leaderstats:FindFIrstChild("Points") Cursor.Button1Down:Connect(function() if (Points) then if not (CanUse) then return end; CanUse = false Points.Value = (Points.Value + 1) wait(1) CanUse = true end end) end)