Problem tweening the Humanoid Root Part!

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want a script that can tween smothly the HRP to another point.

  2. What is the issue? Include screenshots / videos if possible!
    The tween work, but is exrtemly buggy and the character keeps bouncing up and down.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I still didn’t find nothing, except some fixes for the dictionary bug.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local goal= {CFrame = game.Workspace.TweenedPositionPart.CFrame}

local tweenService = game:GetService("TweenService")

local tweeninfo =TweenInfo.new(
	2.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0)

local tween2 = tweenService:Create(script.Parent.HumanoidRootPart, tweeninfo, goal) 

tween2:Play()

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

2 Likes

tweening sets the cframe once every frame to the next value interpolated, but the physics system moves the character down at the same time due to gravity, which explains what you see. Fix it by anchoring the character while the tween is playing

4 Likes

Thank you so much you’re a life saver!

Do you think there is a way to make the character go like that in lerping by the way?

1 Like

Do you mean a way to anchor the character when the tween plays to avoid the stuttering / conflicting movement?

Yeah, try this:

local TweenService = game:GetService("TweenService")

local rootPart = script.Parent.HumanoidRootPart
local goal = {CFrame = game.Workspace.TweenedPositionPart.CFrame}

local tweeninfo =TweenInfo.new(
	2.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

local tween = TweenService:Create(rootPart tweeninfo, goal) 
rootPart.Anchored = true
tween:Play()
tween.Completed:Wait()
rootPart.Anchored = false
1 Like

Works great! Thank you so much for the help!

1 Like

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