Elevator Jitters using TweenService

I am trying to have an elevator move players down, where it then stops and falls down (a jumpscare, an elevator failure).
When the elevator is moving down steadily before it stops, as you would expect a regular elevator to, but the elevator jitters while moving and I don’t know why it is doing so. The elevator starts off moving normally, however it jitters and can make the player move in unintended ways.
Nothing I found accurately helped me with my issue, as I would like to use TweenService still and have it not jitter.

Code:

if APlayers.Value == 1 then
			prompt.Enabled = false
			for _,b in pairs(game.Workspace["Elevator House"].Barriers:GetChildren()) do
				b.CanCollide = true
			end
			local CFrameValue = Instance.new("CFrameValue")
			CFrameValue.Value = model:GetPrimaryPartCFrame()

			CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
				model:SetPrimaryPartCFrame(CFrameValue.Value)
			end)

			local tween = tweenService:Create(CFrameValue, info, {Value = CFrameValue.Value - Vector3.new(0, 20, 0)})
			local tween2 = tweenService:Create(CFrameValue, info2, {Value = CFrameValue.Value - Vector3.new(0, 60, 0)})

			tween:Play()
			tween.Completed:Connect(function()
				model.Center.Sound:Play()
				task.wait(8)
				model.Center.Sound2:Play()
				tween2:Play()
				event:FireAllClients(player)
				task.wait(1)
				-- do tp stuff here within 3 seconds, this part is irrelevant to the tween stuff as it happens after the tweens
				for _,v in pairs(players:GetChildren()) do
					local char = v.Character
					if char then
						local humanrootpart = char.HumanoidRootPart
						if humanrootpart then
							task.wait(2.238)
							local x = tppart.Position.X + math.random(-tppart.Size.X/2,tppart.Size.X/2)
							local y = tppart.Position.Y + math.random(-tppart.Size.Y/2,tppart.Size.Y/2)
							local z = tppart.Position.Z + math.random(-tppart.Size.Z/2,tppart.Size.Z/2)
							humanrootpart.Position = Vector3.new(x,y,z)
						end
					end
				end
--end of irrelevance
				tween2.Completed:Connect(function()
					CFrameValue:Destroy()
				end)
			end)
		elseif game:GetService("ServerStorage").Check.Value == 1 then
			game:GetService("ReplicatedStorage").ShowNotification:FireClient(player, "All players must be on the elevator!", 4)
		else
			game:GetService("ReplicatedStorage").ShowNotification:FireClient(player, "Seems the power isn't working. There should be a generator somewhere.", 4)
		end

I’m not the most experienced scripter, and I don’t know if the script I have to move the whole model at once is the best to use here. It uses the primary part to move the entire model.

It might purely be how ROBLOX physics works, does it jitter in relation to anchored, non-moving parts?

It shouldn’t. I watched tutorials on how to make doors work using tweenService and did the same since I’m no pro scripter. However, I did experiment by making the door with the hinge part unanchored but welded to the baseplate and it worked just fine.

Try setting Network-Ownership,

BasePart:SetNetworkOwner()

Usually stops (or at least helps prevent) jittering of physic’s but im not entirely sure in this case


Link Here:

All parts are anchored because I don’t really think they need to be unanchored as it would just make the elevator fall when it isn’t used (it only is used once during a cutscene) and using SetNetworkOwner doesn’t work on an anchored part

Are you able to show a video of the jittering?


I don’t know if it’s more “stutter” than jitter, but this is what it looks like.

So, This appears to be a Normal Thing Roblox Physics does, its not really fixable (Especially with Tweens and CFrame) but ill try to come up with a fix

Alright, thank you. I don’t really know if there’s another way to do it, as many other games I know have smooth elevators like I’m looking for, but I don’t know how they work so that’s something. Thanks for clarifying Tweens and CFrames can’t really do that well.

Is this being done on the server? You might want to use a remote event that localscripts connect to, and do the tweens on there. Doing tweens on the server usually result in some form of lag.

You could also use :Lerp().

1 Like

Do the tweens on the client, and it will look better. Also maybe trying using Model:PivotTo(cf)

After switching the tweens to the client, it looks a lot better, thank you. There’s some stutter, but that’s roblox. Thank you all for your help!

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