So, basically, in this block of code, I want to make an elevator to move on the Y axis until the base part's Y axis reaches 10 (exactly), and yet the elevator continues to move upward, and not stopping at 10.
if Elevator.InUse.Value == false then Elevator.InUse.Value = true while Elevator.Base.CFrame.y ~= 10 do --Problem area for _,v in pairs(Elevator:GetChildren()) do if v.ClassName == "Part" then v.CFrame = v.CFrame * CFrame.new(0,0.1,0) end end for _,v in pairs(script.Parent.Parent:GetChildren()) do if v.ClassName == "Part" then v.CFrame = v.CFrame + Vector3.new(0,0.1,0) end end Elevator.EleDoors.EleDoorLeft.CFrame = Elevator.EleDoors.EleDoorLeft.CFrame * CFrame.new(0,0.1,0) Elevator.EleDoors.EleDoorRight.CFrame = Elevator.EleDoors.EleDoorRight.CFrame * CFrame.new(0,0.1,0) wait(0.02) end Elevator.InUse.Value = false end
Is there a way to change "while Elevator.Base.CFrame.y ~= 10 do" so that the Base part's position will determine how far the elevator moves upward?