i have a door that opens and closes Vertically but if a player is under the door, the door stops and is off track on future movements. anyone have a way to stop this?
here is my code
function click()
if(script.Parent.Status.Value)=="Closed" then
script.Parent.Status.Value="Opening"
movements=58
speed=0.4
for i=1,movements do
wait(0.01)
script.Parent.Position=Vector3.new(script.Parent.Position.X,script.Parent.Position.Y+speed,script.Parent.Position.Z)
end
script.Parent.Status.Value="Open"
elseif(script.Parent.Status.Value)=="Open" then
script.Parent.Status.Value="Closeing"
movements=58
speed=0.4
for i=1,movements do
wait(0.01)
script.Parent.Position=Vector3.new(script.Parent.Position.X,script.Parent.Position.Y-speed,script.Parent.Position.Z)
end
script.Parent.Status.Value="Closed"
end
end
script.Parent.Control1.SurfaceGui.TextButton.MouseButton1Click:connect(click)
script.Parent.Control2.SurfaceGui.TextButton.MouseButton1Click:connect(click)

2 comments
sorry the CFrame operations are cut, if you need the rest comment and il post it
Maybe make it so that a player can't go under the door?