Animation and Teleport Problem

I am trying to create a script that teleports you somewhere and start playing an animation. However, when I teleport my legs go under the map and as a result, the animation doesn’t work correctly.

	plr.Character.HumanoidRootPart.CFrame = script.Parent.Parent.TpPart.CFrame
	humanoid.WalkSpeed = 0
	humanoid.JumpHeight = 0
	local animationTrack = humanoid:LoadAnimation(animation)
	animationTrack:Play()
	wait(8)
	humanoid.WalkSpeed = 16
	humanoid.JumpHeight = 7.159
	
end)
2 Likes

Utilize the method PivotTo(pivot: CFrame) of the Model class if you want to CFrame the player’s character model. I believe Roblox recently made it so the character PivotPoint is at the base of the bounding box so you would most likely just need to pivot to your part and offset by a set amount or not at all. It’s honestly up to you. As for your animation, make sure it’s set to a higher priority than any of the core ones used by Roblox’s Animate script. I usually set my animations to “Action” just to be safe.
Also, if you’re waiting for the animation to complete, you could use animationTrack.Stopped:Wait() for an event-based approach. Another thing, make sure you’re using task.wait over wait since it internally uses RunService.Heartbeat for more accurate yield times. Hope this helps. :+1:

1 Like

I am aware it’s still the same.

plr.Character:PivotTo(script.Parent.Parent.TpPart.CFrame)
	humanoid.WalkSpeed = 0
	humanoid.JumpHeight = 0
	local animationTrack = humanoid:LoadAnimation(animation)
	animationTrack:Play()
	wait(8)
	humanoid.WalkSpeed = 16
	humanoid.JumpHeight = 7.159
	
end)

Seems like a part blocked the animation, but I will still give you the solution for giving me some extra essential information.

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