What I want to do is this: Put a debounce in the script. SO then if you click the button the gate will slide thorough. But if you click it again it will slide back. But you have to wait a couple seconds for it to slide back. I am also toying around with it to see if I can make it not make the gate go too far if it is repetedly pressed. I would love it if someone would help me!
DoorSystem = script.Parent
Door = DoorSystem.Door1
DoorPad = DoorSystem.Open.ClickDetector
local padPressed = false
function Slide()
if not padPressed then
padPressed = true
for i = 1, 500 do
Door.CFrame = Door.CFrame + Vector3.new(0, 0, 0.1)
wait()
end
end
end
DoorPad.MouseClick:connect(Slide)

1 comment
(I responded to your comment; I had a typo in my script which made it move extraordinarily faster than it is meant to)