Player's CFrame being seen changed after animation ends

Hello,
Lately I’ve been working on a wall climbing system in my game. It works by changing the players HRP’s (HumanoidRootPart) CFrame to the starting part’s CFrame and then plays the climbing animation; once the animation ends it sets the HRP’s CFrame to the end part’s CFrame.

It works as expected for the most part but in the video below, for whatever reason you can catch a glimpse of the player’s HRP’s CFrame being changed to the End part’s CFrame once the animation ends.

I’m wondering if anyone knows a fix to this problem? (Also I’ve tried having the animation play locally and firing remote events to have all the server-sided stuff play with the same problem)

Video:


Layout of the model:

Note:

  • The Parts in red are the “Start” and “End” parts to where the player’s HumanoidRootPart are positioned to during and after the duration of the animation.
  • The Model “Wall Climb” is a child to Workspace.
  • The climbing animation is set to Action priority and is NOT looped.

Script:

local AnimHolder = workspace:WaitForChild("AnimationLoader")
local ProxPrompt = script.Parent
local Animation = script:FindFirstChild("Animation")

-- Plays on another rig so that the animation is preloaded for the player
local track2 = AnimHolder:WaitForChild("Humanoid"):LoadAnimation(Animation)
track2:Play()

ProxPrompt.Triggered:Connect(function(plr)
	local char = plr.Character
	if not char then return end

	local humanoid = char:WaitForChild("Humanoid")
	local charHRP = char:WaitForChild("HumanoidRootPart")

	local StartPart = ProxPrompt.Parent.Parent:WaitForChild("Start")
	local EndPart = ProxPrompt.Parent.Parent:WaitForChild("End")

	local track = humanoid:LoadAnimation(Animation)

	-- Player's movement frozen
	humanoid.WalkSpeed = 0
	humanoid.JumpPower = 0

	-- Player's CFrame changes to Starting CFrame
	charHRP.CFrame = StartPart.CFrame

	-- Animation plays
	track:Play()
	
	-- Player's CFrame changes to Ending CFrame
	track.Stopped:Connect(function()
		charHRP.CFrame = EndPart.CFrame
		humanoid.WalkSpeed = 8
		humanoid.JumpPower = 35
	end)
	
end)
2 Likes

That happens because the player gets teleported to the end CFrame before the animation fully stops. It “smooths” back to the original position of the animation, for a certain duration.

Either the root part needs to move by itself to the end location throughout the animation, which you’d have to implement yourself since Roblox does not do it natively, or, there’s some other way to make that section where the animation fades back to normal be very very short.

You could also try this? I will test it and see if it works. It does not. But you could try this resource or this one.

1 Like

I found the solution, the solution in this post essentially stops the fade time which solved my issue.

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