Tweening a Model Up and down

Hello there! im making a lift for my new game and i want it to tween up and down so players can see it, the script i have is making the lift model rotate , i dont know how to script it to tween to go up and down , can anyone script it with the best performance code OR modify my rotate script accordingly !

local TweenService = game:GetService("TweenService")
local door = workspace:WaitForChild("Skull")
local hinge = door:WaitForChild("HumanoidRootPart") --Hinge is the primary part of the model and is the only anchored part
local tweenInfo =, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)
local tween

local function RotateDoor()
	--This will grab the hinge's current pivot and rotate it by 120 degrees (use -120 to rotate in the other direction)
	--This does not go to a 120 degree fixed orientation in the workspace, rather it transforms the current rotation by 120 degrees
	--It works regardless of the current rotation
	--120 is chosen because it is a factor of 360, so the tween will always move in the same direction
	tween = TweenService:Create(hinge, tweenInfo, {CFrame = hinge:GetPivot() * CFrame.Angles(0,math.rad(120),0)})

local function DestroyTween()
	tween:Pause() --Immediately stops the tween in its current location. Using cancel or destroy has a small delay
	tween:Destroy() --Cleanup

RotateDoor() --Initial play to begin the loop
--An example of how to stop the tween loop

--And how to restart it after it was stopped
RotateDoor() --Notice how the object will resume its rotation from its current spot and doesn't need to reset

1 Like

To tween a model, you can define a primarypart and make sure its anchored. For every other part in the model, unanchor them and weld them to the primarypart with a weldconstraint. Then you can just tween the primarypart, and the whole model should tween. There may be other methods, but as far as i could read, this is the best option.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.