The animation is climbing a building. I want to be able to step on this part and have the animation lock in, and you not be able to move (cause right now you can still move around and change the direction with shiftlock). And I want the character to end at the top of the little building, able to move around again (after the animation is finished). It would also be nice to have the camera follow the character as the animation plays through (right now it just stays where the animation is triggered, and the player gets teleported back to the starting position after the animation is over)
This is what I've got now but it doesn't work the way I want it to. I'm new to scripting so CFraming is a mystery to me, the -- cframe part is my trying to get the CFrame value of lowertorso when the animation reaches the final keyframe before stopping, so that when it stops I can try CFraming the torso to the new position.
local animation = script.Parent.Animation
local debounce = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
debounce = true
local AnimTrack = hit.Parent.Humanoid:LoadAnimation(animation)
AnimTrack:play()
local weld = Instance.new("WeldConstraint")
weld.Part0 = script.Parent
weld.Part1 = hit.Parent.HumanoidRootPart
weld.Parent = script.Parent or hit.Parent.HumanoidRootPart
--hit.Parent.LowerTorso.Cframe:GetComponents()
AnimTrack.Stopped:wait()
weld:Destroy()
debounce = false
end
end)
Can anyone offer some guidance? Thank you.

3 comments
I forgot to mention that I haven't gone through with the CFraming stuff yet, and I'm not exactly sure how I would go about that either. I also forgot to say that being new to animations, when I made this animation I didn't specify any keyframe names or anything. But I know my animation length is 1.5 seconds, and the last keyframe is at 1.4. Not sure if I can do something with that
Once you touch the first part, do you want the character to climb automatically?
Yeah I do