Tweening humanoid is extremely laggy

  1. I want to achieve a tweening with the humanoid which is what I have done. The only problem is that it looks and feels extremely bad and unproffessional.

is there anyway to make the tween smooth? or maybe another way other than tweening that will keep everything looking good? or is the problem in the humanoidrootpart side?

https://gyazo.com/6cee6ab83807bdf899a226a44f2d6ea8

local remote = game.ReplicatedStorage.RemoteEvent
local TweenService = game:GetService("TweenService")

remote.OnServerEvent:Connect(function(p, player)
	local humr = player.Character.HumanoidRootPart
	local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
	local goals = {CFrame = humr.CFrame * CFrame.new(0,10,-20)}
	local HumrTween = TweenService:Create(humr, tweenInfo, goals)
	HumrTween:Play()
end)
1 Like

For moving the humanoid around, you might want to use a forward BodyVelocity, and set the Network Ownership to the player who is moving so that it doesn’t lag.

Yeah but I want to make some sort of wall animation where if you double jump beside a wall it will make you climb it. BodyVelocity won’t be very clever to use there

Yes, that is true. What you can do is used .Touched, and then change the direction of the velocity to Up so that the player climbs the wall. For the animation you can use:

local anim = player.Character.Humanoid.Animator:LoadAnimation(animation)
anim:Play()
1 Like

Yes I will try to do the bodyVelocity to up thing. What about when you finish the animation. Your suppose to be standing on top. Should I make a bodyVelocity making you go forward too?

Well, it depends on where the player is, but yes… make the bodyvelocity go forward. When the anim is finished, if the player has finished climbing then anim:Stop() but if not then play the anim again.

If this works then please list this as a Solution! Thanks!

1 Like

I know this is an old forum, but I had the same issue and found a solution, so if anyone else will encounter this, here it is.
You need to set the network ownership of the part to the server, so the line of code would be:

humr:SetNetworkOwner(nil)
1 Like

No that does not fix the client-side from experiencing an unsmooth tween. It may make it smooth on the server but not the client.

For anyone wondering the solution to this issue:
Anchoring the HumanoidRootPart (in this case) while the tween is in action, and un-anchoring it when your tween is finished should resolve the issue.
Reason being is while you are tweening your object, your characters position is fighting between the gravitational pull downward and your tween. Resulting in a buggy tween. So by anchoring your character, your object is not subject to the gravitational pull. Essentially

Hope this helps :+1:

1 Like

I’m not the owner of the post but this is the solution, thanks!