Basically, im trying to make a door, and I made a script that works with only one button, however, I wanted to add a debounce so it can't be spammed. Only when I added it, it screwed up my script.
if DoorDebounce == false then
DoorDebounce = true
if DoorIsUp then
Door.Anchored = false
DownTween:Play()
print("tween just played")
wait(5)
Door.Anchored = true
DoorIsUp = false
else
Door.Anchored = false
UpTween:Play()
print("tweenJustplayed")
wait(5)
Door.Anchored = true
DoorIsUp = true
end
DoorDebounce = false
end
end)
Ya see, when I have the waits in there (like the code above) then the debounce works just fine, however this intern screws up the door when it's coming down. The opposite is true, when they are not there the debounce does not work, but the door does. I'm not sure how a wait can affect it. And yes, I have tested and I am positive that the "wait" is the problem.

1 comment
Thanks!