Door = game.Workspace.Door
Button = game.Workspace.Button
local buttonPressed = false
Workspace.Button.Touched:connect(function(hit)
if not buttonPressed then
buttonPressed = true
for i=0,5,.1 do
Door.CFrame = CFrame.new(86.48, 4.89, -i)
wait(3)
Door.CFrame = CFrame.new(86.48, 4.89, i)
buttonPressed = false
end
end
end)
My first problem is the part (Door) is moved on the Z axis to what I guess is either 0 or .1 while I just want to stay in it's current place (86.48, 4.89, -35.935) and just move to the left 5 studs, which is working. I also don't understand how to make it move back into place after 3 seconds but isn't working and I don't have any idea how to fix this one.

6 comments
This is was really helpful but I think there needs to be a wait somewhere because when I tried to use this my studio crashed.
Hmm, I added a wait() in there, see if that helps.
No more crashing but the script doesnt do anything.
Try now, I simplified it a lot. It just moves it 10 block, rather than to a specific position. I think I messed up the old for line anyways.
This works but I still want it to move from it's original position. This moves it to the middle of the map and then moves 10 studs
Just change the "1" in "i=1" to whatever the starting point of your door is. Alternatively, you can make it "i=Door.Position.z", as I believe that works.