Server Tweening animation is not smooth client side

I am attempting to make a local script call a server script to create an animation, but the only problem is the animation is choppy when viewed from the client, But not from the server. Can this work so it looks smooth for both parties?

Local Script:

repeat wait() until game.Players.LocalPlayer.Character
repeat wait() until game.Players.LocalPlayer.Character.Head
local Head = game.Players.LocalPlayer.Character.Head
local tween = game:GetService("TweenService")
local base,mid,top=game.ReplicatedStorage.Maker:InvokeServer(Head)
local goal1=base.C0*CFrame.Angles(math.rad(45),0,0)
local goal2=base.C1*CFrame.Angles(math.rad(0),0,0)
wait(2)
game.ReplicatedStorage.Animator:InvokeServer(base,goal1,goal2,"Sine",1)
--local info=TweenInfo.new(
--	1,
--	Enum.EasingStyle.Sine
--)
--local anim=tween:Create(base,info,{C0=goal1,C1=goal2})
--anim:Play()

Server Script:

local playercarrier=Instance.new("Model")
playercarrier.Name="playermodels"
playercarrier.Parent=game.Workspace
local tween=game:GetService("TweenService")
game.ReplicatedStorage.Maker.OnServerInvoke = function(Player,Head)
	local playerfolder=Instance.new("Model")
	playerfolder.Name=("playerfolder_"..Player.Name)
	playerfolder.Parent=playercarrier
	for i=1, #Head.Parent:GetChildren() do
		local list=Head.Parent:GetChildren()
		if list[i].ClassName=="Part"and list[i].Name~="Head" then
			list[i].Transparency=1
		end
	end
	local base=Instance.new("Part")
	base.Size=Vector3.new(1,1,1)
	base.CanCollide=false
	base.Parent=playerfolder
	local baseweld=Instance.new("Weld")
	baseweld.Parent=base
	baseweld.Part0=base
	baseweld.Part1=Head
	baseweld.C0=CFrame.new(0,-3,0)
	local mid=Instance.new("Part")
	mid.Size=Vector3.new(1,1,1)
	mid.CanCollide=false
	mid.Parent=playerfolder
	local midweld=Instance.new("Weld")
	midweld.Parent=mid
	midweld.Part0=mid
	midweld.Part1=base
	midweld.C0=CFrame.new(0,-3,0)
	local top=Instance.new("Part")
	top.Size=Vector3.new(1,1,1)
	top.CanCollide=false
	top.Parent=playerfolder
	local topweld=Instance.new("Weld")
	topweld.Parent=top
	topweld.Part0=top
	topweld.Part1=mid
	topweld.C0=CFrame.new(0,-3,0)
	return baseweld,midweld,topweld
end
game.ReplicatedStorage.Animator.OnServerInvoke = function(Player,joint,c0,c1,alpha,Duration)
	local info=TweenInfo.new(
		Duration,
		Enum.EasingStyle[alpha]
	)
	local anim=tween:Create(joint,info,{C0=c0,C1=c1})
	anim:Play()
end

If you must know why I used a remote function instead of a remote event then that is because I hope to make a system where it will wait until the tween is done, so I can make a loop of 2 tweens like a tween1.Completed:Connect(function() tween2:Play() end)

Video of animation client side:

Video of animation server side:

I have tried to make both animations run both client side and server side, but that lead to the animation jumping around on more complicated animations.

I hope this is all clear and that anyone can help me!

1 Like

I guess I am asking how to make animations smooth both on server side and client side.

If you Play the tween on ServerSide, will always have delay/stuttering issues with the clients, I think there is no way to get smooth animations on both sides at the same time.

What you could do is play the tween client side, and if you want other players see the animation too, you could use a remote to tell all other clients to play the same tween on their sides.