So I have a script that moves a door forward, then to the side, but it's meant to stay there until the handle is re-clicked, but it moves backwards afterwards, but I don't know why...
function click() if(script.Parent.Status.Value)=="Closed" then script.Parent.Status.Value="Opening" local sidemoves=2 local sidespeed=0.1 for i=1,sidemoves do wait(0.01) script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(-sidespeed,0,0)); end wait(0.5) local movements=91 local speed=0.1 for i=1,movements do wait(0.01) script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(0,0,-speed)); end script.Parent.Status.Value="Open" --negative movement elseif(script.Parent.Status.Value)=="Open" then script.Parent.Status.Value="Closing" local movements=91 local speed=0.1 for i=1,movements do wait(0.01) script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(0,0,speed)); end script.Parent.Status.Value="Closed" end wait(0.5) local sidemoves=2 local sidespeed=0.1 for i=1,sidemoves do wait(0.01) script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(sidespeed,0,0)); end end script.Parent.PLT.Union.ClickDetector.MouseClick:connect(click)