Help with moving model

Hello, so I am making a elevator lift. I’m not sure why this isn’t working.

– Variables
local isSurface = true
local elevator = script.Parent
local surfaceControl = script.Parent.ElevatorSurfaceControl
local mainControl = script.Parent.ElevatorControl
local entranceControl = script.Parent.ElevatorEntranceControl
– Main Code
mainControl.Down.ProximityPrompt.Triggered:Connect(function(down)
repeat
elevator.PrimaryPart.Position = elevator.PrimaryPart.Position = Vector3.new(0,-1,0)
wait(0.1)
until elevator.PrimaryPart.Position == Vector3.new(-55.869, -150, -646.045)
end)

I’m trying to change the position of the elevator until reaches -55.869, -150, -646.045.

Take a look at the new “SetPrimaryPartCFrame”:

1 Like

Thank you.

word
word
word
word

1 Like

When I do it, I’m getting this error and nothing is happening.


Here is my code:

local isSurface = true
local elevator = script.Parent
local surfaceControl = script.Parent.ElevatorSurfaceControl
local mainControl = script.Parent.ElevatorControl
local entranceControl = script.Parent.ElevatorEntranceControl
– Main Code
mainControl.Down.ProximityPrompt.Triggered:Connect(function(down)
repeat
elevator.PrimaryPart:PivotTo(CFrame.new(-55.869, -150, -646.045))
wait(0.1)
until elevator.PrimaryPart.CFrame == CFrame.new(-55.869, -150, -646.045)
end)

I’m moving the primary part in the elevator. I also have the primary part set.
image

You have to use the pivot on the Model, not a part.

Is there a way to check if the model is around a certain position?

You could check the Magnitude between the primary part and the end position:
Magnitude (roblox.com)

Okay. When I used :PivotTo, it just disappears. I don’t even know where it went.
image
I set the numbers to the models origin position where I want it to go. It didn’t even go there. Also, is there a way to make it slowly move because I want the player to be able to stand on it, it’s a elevator lift.

Use a for loop.
Also, you will need to add the currentPivot in the for loop

for i = 1, 150 do
local currentPivot = elevator:GetPivot()
character:PivotTo(currentPivot - Vector3.new(0, 1, 0) 
end
1 Like