Elevator Movement Shakes while Player Present (Movement with TweenService)

  1. What do you want to achieve?
    Prevent the shaking while player present.

  2. What is the issue?

(Quality is not very good I can provide another video if needed)

  1. What solutions have you tried so far?

I have tried the following code:

function elevatorMove(level, callbutton, newPosition)
	local PrimaryPlate = cage.Mainplate:FindFirstChild("PlatePrimary")
	
	if PrimaryPlate.Position.Y ~= newPosition.Position.Y then
		callbuttonDebouce(false)
		-- Elevator En-route
		callbutton.ProcessLight.BrickColor = BrickColor.new("Neon orange")
		cage["Elevator Button"].Model["Call-Button"].ProcessLight.BrickColor = BrickColor.new("Neon orange")
		
		script.isMoving.Value = true
		
		local TweenService = game:GetService("TweenService")
		
		local tweenTime = math.round(PrimaryPlate.Position.Y - newPosition.Position.Y) / 10
		print(tweenTime)
		
		if (PrimaryPlate.Position.Y - newPosition.Position.Y) < 0 then
			tweenTime = tweenTime * -1
		end
		
		local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
		local newYPos = PrimaryPlate.Position.Y - newPosition.Position.Y
		
		TweenService:Create(PrimaryPlate, tweenInfo, {
			CFrame = PrimaryPlate.CFrame * CFrame.new(0, newYPos * -1, 0)
		}):Play()
		
		wait(tweenTime)
		
		script.isMoving.Value = false
		openDoors(level, cage, callbutton)
	else
		callbuttonDebouce(false)
		openDoors(level, cage, callbutton)
	end
end

The above function is ran via a ProximityPrompt or with UI when appropriate and uses other functions to do other tasks. (I do not find them necessary to include)

This code allows me to move the elevator but from this solution raises the issue of shaking in movement. The elevator does contain three (3) floors.

All the parts are welded to the floor of the elevator using WeldConstraints generated by script.

Further Note: I did not build this elevator (@Dr3mD3x) nor intend to take credit for the building I am only tasked with scripting it.

Hi!

You should not use tweenservice for this. Instead you should use AlignPosition

Alright, I will see to giving this a try but a further maybe relevant point is this elevator has three floors.

Well, then you setup checkpoints, and determine the AlignPosition to whatever position/floor you want your elevator to go to. :slight_smile:

I can’t really get the AlignPosition constraints to work with the elevator, is their any other way to prevent the shaking? (Without the player the tweening is much less shaky, even though it may not be the best method)

TweenService updates (in this case) the position all the time with decimals, it does not really move the object. What issue are you facing with AlignPosition?

It is likely, due to me not doing something correctly but anyways even when I just move a part of the bottom it doesn’t perfectly align with the destination.

(The selected part is the destination)

I should have stated this earlier but the model has about 340 parts.

If the orientation is off, then also use AlignOrientation

Ah, thanks got any good guides / tutorials or documentation for doing this with models?

Not really no. But I assume that you with models will use the PivotPoint. PivotPoints is the 3D objects equivalent to a UI objects AnchorPoint. You can change the position of the PivotPoint relative to the model, to whatever you like.

Thanks for your help, I think I will just open a new topic to see if anyone can assist me in doing it with a model. (I am kind of getting there but still struggling)

Just weld the player to a platform or any part in elevator and for better look turn on player’s Humanoid’s property PlatformStand to true