How do I make the tweening of players character less stutery

I have explained most of the issue in the title itself, what I have is a script and a video.

Services.TweenService:Create(
Hit.Parent.HumanoidRootPart, 
TweenInfo.new(1), 
{["Position"] = k.Position + Vector3.new(0, 10, 0)}
):Play()

2 Likes

I’d advise you to not use tweening on the player’s character, Instead use lerping which is more suitable for physics and real time calculations.

1 Like

I’m having some trouble trying to lerp, I think I gave the right parameters but nothing is being done and there is nothing in the output.

Hit.Parent.HumanoidRootPart.Position:Lerp(k.Position, 10)

Lerp the CFrame instead of Position and use a For Loop.

what to do:

local part = workspace.Part
local endPoint = workspace.endPoint

local partCFrame = part.CFrame
local endPointCFrame = endPoint.CFrame

for i = 0, 1, 0.001 do
	part.CFrame = partCFrame:Lerp(endPointCFrame, i)
	task.wait()
end

Will this cause any lag if i do it on the server?

i’ve just tested it and there does seem to be some delay in the server compared to the client, however its a very small amount of delay and and its a lot better than tweening.

If you do want to stick to tweening instead of lerping. I had this issue before, you have to anchor the player before tweening them. That should fix it. Then unanchor them using the tween.Completed event😎 (Yes you can tween anchored parts)

Its cause the game wants to pull the player down cause gravity but it creates that stuttering cause the tween is forcing the player to move your desired way. Anchoring stops the stuttering cause screw gravity.

I suggest also making the character uncollidable and making the character spawn a little more higher on top of the spawnpoint so there’s no potential clipping issues

2 Likes

I have tried and the players character still does not, lerp

for i = 0, 1, 0.1 do
   Hit.Parent.HumanoidRootPart.CFrame:Lerp(k.CFrame, i)
end

try anchoring the player while tweening
also, tween on the client not server for smooth movement

2 Likes

make sure the character and the k value exist first, also anchor the humanoidRootPart before lerping as @DIREFUL_7N1F3 said.

1 Like

I have stumbled across one issue,
first video is when i try to only tween hrp, 2nd is when i try to tween every part inside the character


for _, a in Hit.Parent:GetDescendants() do
							if a:IsA("Part") or a:IsA("MeshPart") then
								a.Anchored = true
								a.CanCollide = false
								local tween = Services.TweenService:Create(a, TweenInfo.new(1), {["Position"] = k.Position + Vector3.new(0, 2, 0)})
								tween:Play()
								tween.Completed:Wait(Enum.PlaybackState.Completed)
								a.Anchored = false
								a.CanCollide = true
							end
						end

Nononono you only tween the humanoidroot part(Its the part that connects everything together). The only things you should be adjusting on the whole character is the collisions and the anchored. Not only that but tweening all them parts is pretty unoptimized when you already have the parts welded together hahaha

If i try to tween the hrp i get a situation like in the first video, where the character stays still, and only the hrp get’s moved.

Actually try anchoring only the humanoidrootpart. THAT should fix it, Just change the collisions for every part though.

1 Like

Thank you this has quite helped, appreciate the help!
Althought i didnt disable can collide on the character because that brought me another set of issues.

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