Tween is Choppy

Hello, I’m perfomring a tween on a server, a form of control an object type game.

It runs smoothly on the server when I’m alone, but as soon as another player joins it starts to become choppy.

Videos:

Code:


local TweenService = game:GetService('TweenService')

local info = TweenInfo.new(1)


script.Parent.Parent.Events.Path.OnServerEvent:Connect(function(Player, WayPoint)
		
	local AmountOfPoints = #WayPoint

	local LookAt = WayPoint[AmountOfPoints]		
		
	local Speed = script.Parent.Parent.Information.Speed.Value
	local function GetTime(Distance, Speed)

		local Time = Distance / Speed
		return Time
	end

	local NewPoint = LookAt
	local Distance = (script.Parent.Parent.Cover.Position - NewPoint.Position).Magnitude 
	local Time = GetTime(Distance, Speed)
	print(Time)

	local NewTweenInfoTable = TweenInfo.new(
		Time, 
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.Out, 
		0, 
		false,
		0 
	)
	

	local Goal = {}
	Goal.Position = Vector3.new(LookAt.Position.X,script.Parent.Parent.Cover.Position.Y ,LookAt.Position.Z)
	local NewTween = TweenService:Create(script.Parent.Parent.Cover, NewTweenInfoTable, Goal)

	NewTween:Play()
	NewTween.Completed:Wait()
	

Any idea how to fix this?

Thanks in advance for any help.
I can provide more information if necessary!

I would try to use :SetNetworkOwner() along with local tweening code. This should make it smoother for the player who is controlling the moving part.

1 Like

You could do what @IcyyDicy suggested, or just tell the clients to render the tween with a simple remote event. All tweens are typically better on the client than the server. The server should just set the position of the object after the tween is completed.

1 Like

Yeah, that could work, but I do believe that only happens because roblox studio testing servers run on the local machine, not on roblox servers. I do believe that just happens due to lag on your PC.

1 Like

Decided to use Lerp. It performed better than TweenService. Thanks for all the replies!