I am creating a door that opens when you touch an invisible part, but the issue is if I keep stepping on the part, the open door script keeps playing and causes the door to glitch.
Does anyone know how to debounce the door?
Do this
local t = tick()
local timetoWait = 5
function OnTouched(part)
if (tick() - t) >= timetoWait then
-- ur code here
t = tick()
end
end
local yes = false
--ontouch function line there
if yes == true then return end
yes = true
--the rest of the stuff
yes = false
--end) i guess