What is the best way to determine how long a tween should take for an elevator?

I am creating an elevator using tweening, everything works fine accept the time it takes to get to each foor.

For example, I was using 0.2 * Y axis of the floor marker, this will not work as the Y axis changes depending on where you place the building and also when the elevator moves down in floors it moves too quickly.

I was then experimenting with using the floor levels but again this doesn’t work since going down the floor levels decrease which increases the speed of the elevator.

I need the elevator to take the same amount of time to reach each floor going up and down.

1 Like

Get the distance from the elevator to the floor the elevator is going to travel to, and divide it by your speed to get a constant time.

Example:

local distance = (elevator.Position - nextFloor.Position).Magnitude

local tweenTime = distance / 20 --//The higher the value, the higher the speed