Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 7 years ago

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

Log in to vote
1
Answered by
cfiredog 274 Moderation Voter
7 years ago

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!

Ad

Answer this question