Elevator Movement Shakes

Can someone explain why this elevator shakes and how to fix it for a smoother ride? Thanks.

3 Likes

Mind providing a piece of the script that actually moves it?

2 Likes

Weld your character to the platform when it moves.

1 Like

Are you tweening it based on its CFrame on the server?

The CFrame isn’t interpolated like physics based things, so it would cause the character to fall and stop repeatedly. That could be what’s causing your problem.

Try either tweening it on the client, or using physics (through an AlignPosition and AlignOrientation) to be able to use interpolation, if you aren’t already doing one of these two things.

You can use this great module by SteadyOn to easily do tweens on the client but control them from the server:

2 Likes

OP this is most likely the answer.

This topic comes up a lot and AlignPosition and AlinOrientation is nearly always the answer to any issue where you’re dealing with scripted physics.

1 Like

local ts = game:GetService(“TweenService”)

local topDoorStartPos = Vector3.new(0.811, 35.367, -435.086)
local topDoorEndPos = Vector3.new(0.811, 22.526, -435.086)

local bottomDoorStartPos = Vector3.new(0.811, -639.249, -435.086)
local bottomDoorEndPos = Vector3.new(0.811, -652.458, -435.086)

local elevatorStartPos = script.Parent:WaitForChild(“ElevatorUpPos”).CFrame
local elevatorEndPos = script.Parent:WaitForChild(“ElevatorDownPos”).CFrame
local elevatorMiddlePos = script.Parent:WaitForChild(“ElevatorMiddlePos”).CFrame

local elevator = script.Parent:WaitForChild(“Elevator”)
local topDoor = script.Parent:WaitForChild(“TopDoor”)
local bottomDoor = script.Parent:WaitForChild(“BottomDoor”)
local detector = elevator:WaitForChild(“Detector”)

local waitUpTime = 30
local waitDownTime = 30
local glassCloseTime = 2
local glassOpenTime = 2.75
local elevatorDownTime = 20
local elevatorUpTime = 20

local state = script.Parent:WaitForChild(“State”)

local function GetTouchingParts(part)
local connection = part.Touched:Connect(function() end)
local results = part:GetTouchingParts()
connection:Disconnect()
return results
end

local function tweenModel(model, cframe, time)
local cframeValue = Instance.new(“CFrameValue”)
cframeValue.Value = model:GetPrimaryPartCFrame()

cframeValue:GetPropertyChangedSignal("Value"):connect(function()
	model:SetPrimaryPartCFrame(cframeValue.Value)
end)

local info = TweenInfo.new(time, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = ts:Create(cframeValue, info, {Value = cframe})
tween:Play()

tween.Completed:connect(function()
	cframeValue:Destroy()
end)

end

local function tweenModel2(model, cframe, time)
local cframeValue = Instance.new(“CFrameValue”)
cframeValue.Value = model:GetPrimaryPartCFrame()

cframeValue:GetPropertyChangedSignal("Value"):connect(function()
	model:SetPrimaryPartCFrame(cframeValue.Value)
end)

local info = TweenInfo.new(time, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
local tween = ts:Create(cframeValue, info, {Value = cframe})
tween:Play()

tween.Completed:connect(function()
	cframeValue:Destroy()
end)

end

state:GetPropertyChangedSignal(“Value”):Connect(function()
if state.Value == “GlassUpClosing” then
topDoor.CloseDoor:Play()
ts:Create(topDoor, TweenInfo.new(glassCloseTime), {Position = topDoorEndPos}):Play()
end
if state.Value == “GoingDown” then
–for i, part in next, GetTouchingParts(detector) do
– if part.Parent:FindFirstChild(“Humanoid”) then
– part.Parent.Archivable = true
– part.Parent.Humanoid.WalkSpeed = 0
– part.Parent.Parent = elevator.Players
– part.Parent.HumanoidRootPart.Anchored = true
– end
–end

	tweenModel2(elevator, elevatorMiddlePos, elevatorDownTime / 2)
	
	task.wait(elevatorDownTime / 2)
	
	tweenModel(elevator, elevatorEndPos, elevatorDownTime / 2)
end
if state.Value == "GlassDownOpening" then
	bottomDoor.OpenDoor:Play()
	ts:Create(bottomDoor, TweenInfo.new(glassOpenTime), {Position = bottomDoorStartPos}):Play()
	
	--for i, part in next, GetTouchingParts(detector) do
	--	if part.Parent:FindFirstChild("Humanoid") then
	--		part.Parent.Parent = workspace
	--		part.Parent.HumanoidRootPart.Anchored = false
	--		part.Parent.Humanoid.WalkSpeed = 16
	--		part.Parent.Archivable = false
	--	end
	--end
end
if state.Value == "GlassDownClosing" then
	bottomDoor.CloseDoor:Play()
	ts:Create(bottomDoor, TweenInfo.new(glassCloseTime), {Position = bottomDoorEndPos}):Play()
end
if state.Value == "GoingUp" then
	--for i, part in next, GetTouchingParts(detector) do
	--	if part.Parent:FindFirstChild("Humanoid") then
	--		part.Parent.Archivable = true
	--		part.Parent.Humanoid.WalkSpeed = 0
	--		part.Parent.Parent = elevator.Players
	--		part.Parent.HumanoidRootPart.Anchored = true
	--	end
	--end

	tweenModel2(elevator, elevatorMiddlePos, elevatorUpTime / 2)
	
	task.wait(elevatorUpTime / 2)
	
	tweenModel(elevator, elevatorStartPos, elevatorUpTime / 2)
end
if state.Value == "GlassUpOpening" then
	topDoor.OpenDoor:Play()
	ts:Create(topDoor, TweenInfo.new(glassOpenTime), {Position = topDoorStartPos}):Play()
	
	--for i, part in next, GetTouchingParts(detector) do
	--	if part.Parent:FindFirstChild("Humanoid") then
	--		part.Parent.Parent = workspace
	--		part.Parent.HumanoidRootPart.Anchored = false
	--		part.Parent.Humanoid.WalkSpeed = 16
	--		part.Parent.Archivable = false
	--	end
	--end
end

end)

  1. old and deprecated method
  2. wasn’t you been able to place the code into code block instead of filling the page?

i did this is an old post though

yeah mb it’s old but the method is deprecated and outdated for a quite long time

check out the new post btw the code is in a block there and do you think renderstepping would fix it?

code isn’t in code block
it’s just pasted as plain text

not this post im talking about a new post