hello so im having this problem with .Touched, it usually spams because the part that connects fastly disconnects and connects again (cos of it changing size/shape) so I was wondering on how to make it only do something once instead of multiple times.
I can provide an example:
local p = script.Parent local x = true -- our debounce p.Touched:Connect(function(hit) if x then x = false -- your code wait(5) x = true end end)
As simple as that, if x isn't true, it won't run until x is true.
Good luck! If you have trouble inputting the debounce, feel free to ask me!
Wish you luck on your goal!
local object = script.Parent local deb = false local detime = 5 --debounce time object.Touched:Connect(function(hit) if deb == false then deb = true print("works!") -- your code wait(detime) deb = false end end)