script.Parent.Touched:Connect(function(touched)
script.Parent.Transparency = 0
wait(3)
script.Parent.Transparency = 1
end)
function spike(partTouching)
if partTouching.Parent:FindFirstChild("Humanoid") then
partTouching.Parent.Humanoid.Health = 0
end
end
script.Parent.Touched:Connect(spike)
COMMUNITY QUESTION
How would I apply debounce to my script?
1 answer
Use this :
local Debounce = false
script.Parent.Touched:Connect(function(touched)
if Debounce == false then
Debounce = true
--script here
wait(1) -- amount of time to set Debounce = false
Debounce = false
end
end)
if it doesn't work, tell me
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
if (Debounce) then return end; Debounce = true. You can do all that in one line if you wish to, also, you forgot a to close your conditional scope.
oof forgot that