How would I move this model back and forth slowly?

EDIT : I decided to just put a teleporter inside of the elevator, as its much easier especially with the slow black screen fade

I want to move this model for my elevator non-stop, going back and forth, forever.
It is supposed to be an elevator to carry the player up and down.

I tried multiple methods but they are so quick and I can’t figure out tween-services and what-not.

You can achieve this by using TweenService.

To use this, you would play it following by; Object to Tween, Information about tween, What Property to Tween

Which can be led like this;

local TweenService = game:GetService("TweenService")

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)

For the tween info, the first argument [5] (or put any number there), defines how long the tween will play.

For the second argument; “Enum.EasingStyle.Sine”, it will define what style the tween will play, you can review some right here.

For the third argument, Enum.EasingDirection.Out so called “EasingDirection” can be called by 3 methods; this includes, Enum.EasingDirection.Out, Enum.EasingDirection.In, and Enum.EasingDirection.InOut, you can review them here.

For the 4th argument, it defines how many times do you want the tween to play. Self explanatory.

For the 5th argument, it defines if you want the tween to reverse (5th argument is a boolean, if a value is set for the 4th argument.
e.g:
4th argument is set to 5, 5th argument is set to true, action is, the tween will play once, then once finished, it reverses back to its original starting point, then plays again, until it has played 4 times. If the 5th argument is false, then once the tween finished, it just immediately teleports back to its starting point, and plays again, until it has played that amount of times for the 4th argument.

For the 6th argument (final argument), it defines the delay. self explanatory, how many seconds do you want to wait until the tween plays.

Now, for the goals part which can be represented like this;

local TweenService = game:GetService("TweenService")

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)

local GOALS = {}

Goals represents what type of properties would you like to tween. This can include; transparencies, positions, sizes, Udim2’s, Vectors, CFrames, etc.

For example, we want to smoothly tween the position of a part, we can do so like this;

local TweenService = game:GetService("TweenService")

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)

local GOALS = {Position = Vector3.new(5, 4, 2)}

Goals are represented in a table, you can add multiple properties you want to tween, followed by a comma (if there is multiple).

Final line, it is creating the tween, we can do so like this;

local TweenService = game:GetService("TweenService")

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)

local GOALS = {Position = Vector3.new(5, 4, 2)}

local final = TweenService:Create(game.Workspace.Part, Info, GOALS)

We are creating a tween with the variable “final” (you can set the name to anything.)
3 arguments defined are what we are tweening, 2nd argument, info of the tween, third argument, what properties we want to tween (goals).

Then, we can finally play the tween, like this:

final:Play()

Then, you should have successfully tweened a certain part or class or object, etc. anything.

You can review some tutorials on how to, for example, this one:

(in this case, you would have to tween where the elevator will go to, such as CFrame.

2 Likes

Edit *

Got rid of the errors, yet it doesn’t move. It just stays still.

local TweenService = game:GetService("TweenService")

local Info = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 4, true, 2)

local GOALS = {Position = Vector3.new(0, 6, 0)}

local final = TweenService:Create(game.Workspace.Part, Info, GOALS)
wait(3)

final:Play()
1 Like

If the elevator is a model, try moving it’s CFrame

1 Like