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)
