Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

is there a way to make a anchored model move up and down?

Im making an elevator and i have the model but when it isnt anchored it breaks apart so i need it to be anchored! How would i make it move up for say five seconds and move down for five seconds if it is still anchored!

Thanks for you help! -_-

1 answer

✓ Accepted answer

You can use TranslateBy() to shift a model using a given offset.

So in your case, it would look something like this:

local Model = script.Parent

for i = 1, 60, 0.1 do -- Goes from 1 to 60 (incremented by 0.1)
	Model:TranslateBy(Vector3.new(0, 1, 0)) -- Moves the model 1 stud upward
	wait()
end

for i = 60, 1, -0.1 do -- Goes from 60 to 1 (incremented by -0.1)
	Model:TranslateBy(Vector3.new(0, -1, 0)) -- Moves the model 1 stud downward
	wait()
end

Please mark as best answer if this worked!

This discussion is preserved as it was. New answers, comments, and votes are closed.