Ive made this code that spawn a part for my building game, but some greifers spam it and ruin the game, Any way i can make so you cant spam click it and only click it once per specific time, Heres the small code end)
script.Parent.Activated:Connect(function() game.ReplicatedStorage.PartCreate2:FireServer() end)
You can use a debounce! What is a debounce? This is a small line of code that will prevent the respective scope family from executing. To construct one, you’ll need an conditional statement, and a two variables.
local tool = script.Parent local waitTime = 1 --// interval of time before next click local debounce = false tool.Activated:Connect(function() if (debounce) then return end --// bounce conditional game:GetService("ReplicatedStorage").Part2Create:FireServer() --// modifier debounce = true wait(waitTime) debounce = false end)