Tween player position with Script vs Local Script

I am trying to tween a player’s location using their humanoid root part.

The block of code below works great in a server Script. When I try to use a Local Script, it makes the player’s character spin in a large circle - then moves the player’s camera along with the tween (but not the character).

	local tweenInfo = TweenInfo.new(2)
	local tweenPosition = TweenService:Create(humanoidRootPart, tweenInfo, {Position = tweenDestination.Position})
	humanoidRootPart.Anchored = true
	tweenPosition:Play()
	local tweenCompleted = nil
	tweenCompleted = tweenPosition.Completed:Connect(function()
		humanoidRootPart.Anchored = false
		tweenCompleted:Disconnect()
	end)

Tween the HumanoidRootParts CFrame not the Position

	local tweenPosition = TweenService:Create(humanoidRootPart, tweenInfo, {CFrame = tweenDestination.CFrame})
2 Likes

Yay!

Thank you! I could not figure out why it wasn’t working.

1 Like

Using CFrame instead of Position fixed my problem when using a Local Script (what I wanted.)

But, now when I test I see that the tween does not show up on the Server. Only on the Client.

Does anyone know why the tween is not showing up on the Server?

1 Like

If you Play the Tween on the Client, it only shows up for that Client.
No one else will see it.
You have to play it on the Server

1 Like

Thanks.

Your answer makes sense.

1 Like

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