How can I make this smoother?

I’m using tween service to move a player to a part.

This is what I got:

How could I make this smoother?
All the parts’ cancollide are off.

Code:

local tweenService = game:GetService("TweenService")

local zipline = workspace:WaitForChild("Obstacle"):WaitForChild("Zipline")
local partA = zipline:WaitForChild("A")
local partB = zipline:WaitForChild("B")

local function tweenPlayerToPart(player)
	local character = player.Character
	if not character then return end

	local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	if not humanoidRootPart then return end

	local moveTweenInfo = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
	tweenService:Create(humanoidRootPart, moveTweenInfo, {Position = partB.Position}):Play()

	moveTween.Completed:Wait()
end

local db = false
local function onTouch(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player and db == false then db =true
		tweenPlayerToPart(player)
	end
end

partA.Touched:Connect(onTouch)
3 Likes

It isn’t smooth because you are tweening it on the server, this is bad and unoptimised because of how much network outcome it sends so just play the tween on the client for smoother and more accurate results

3 Likes

I see you are tweening the player consider using lerping instead on a runservice connection as it is the exact same as tweening but allows for more control over every frame of the lerp and it doesnt overload the server as much

2 Likes

Anchor the RootPart before tweening.

This is semi-incorrect, they are faster on the client but not that dramatically worse on the server.

2 Likes

Maybe a lil workaround but couldnt you just Weld the HRP to a invisible part and tween the part.

Nvm, anchoring lik @1O10010I10011 stated is a better solution

1 Like

this videos shows the difference between client and server usage with tweens

4 Likes

I was not stating they are not faster on the client (it is common knowledge that they are faster on the client), rather that they are not that dramatically less performant on the server.

2 Likes

OP is likely using client tweens. Their main problem is not anchoring the HumanoidRootPart thus the character is being affected by gravity whilst being tweened giving this glitchy effect.

3 Likes

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