Hey I was wondering how I'd add a debounce tot his short script, any help would be appreicated. :)
function onTouched(part) script.Parent.Parent.DoorScript.open.Value = true wait(3) script.Parent.Parent.DoorScript.open.Value = false end script.Parent.Touched:connect(onTouched)
canopen = true -- the db function onTouched(part) if canopen then canopen = false script.Parent.Parent.DoorScript.open.Value = true wait(2) script.Parent.Parent.DoorScript.open.Value = false canopen = true else print("Cannot open.") end end script.Parent.Touched:connect(onTouched)
Hope that helped. :)
local debounce = false function onTouched(part) if debounce = false then debounce = true script.Parent.Parent.DoorScript.open.Value = true wait(3) script.Parent.Parent.DoorScript.open.Value = false debounce = false end end script.Parent.Touched:connect(onTouched)
Closed as Not Constructive by hiimgoodpack, Le_Teapots, noammao, Psudar, zblox164, SuperSamyGamer, SirDerpyHerp, and Lugical
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?