How to move CFrame during animation?

Hello, I have an animation that plays once a player is hit making them roll very far back, however, their CFrame stays right in front of me and since this attack finisher is for range, I end up attacking myself since I cant make it hit the CFrame of the target player.

How can I move the CFrame to the end position of the animation?

2 Likes

Bump since no reply in an hour, really would appreciate any help!

1 Like

Sorry, I’m not sure I quite get it because it seems like you are attacking the other player successfully without attacking yourself?

1 Like

Let me attach another video that might clear up the confusion, give me one minute.

1 Like

Medal clip

I highlight the HumanoidRootPart to show you that it doesn’t move with the animation.

Let me elaborate a bit more on it aswell. This is a two part attack, the beginning punch is to activate the actual finisher, which is a pawn chess piece being slammed onto the target player. I didn’t show that in the first video because the piece would drop on me, which I found to be due to the targets CFrame being stuck in the position where it was punched, which is right in front of me. Its like I havent even punched the player if that makes sense since its body is animating but the actual player is still right there.

1 Like

You’re video isn’t working but as you said, the HumanoidRootPart of whatever the animation/tween plays on isnt moving with the whole character?

1 Like

Yes and sorry about the video, In the first clip I used software built into my pc but it wouldnt work after second time for some reason. Basically I am trying to get the CFrame which youre able to see in the first video, right in front of my player, to move either with the animation or to the animations ending.

Also I updated the way I linked the video, see if that helps, if you still need to understand what im trying to get at.

Is this a tween or animation? If its a tween have you tried setting the PrimaryPart of the model to the HumanoidRootPart and using SetPrimaryPartCFrame()?

This is just an animation, the tween seen is for the letterboxing (for cinematic)

Maybe you can try adding Animation Events | Documentation - Roblox Creator Hub to the start of the animation, and update the rootpart using a script

AnimationTrack:GetMarkerReachedSignal(MarkerName):Connect(function()
   --Update RootPart here
end)
1 Like

I will try it out and let you know how it goes, thank you.

1 Like

Maybe im in a little over my head, how would I update the rootpart while its animating? If you wouldnt like to go into that much detail maybe theres a wiki somewhere for this specific thing you could provide me? Otherwise:

if animator then
				local chessTarget = game:GetService("StarterPlayer").StarterCharacterScripts:WaitForChild("CiaranChess").ChessTargetHit -- Replace with correct animation path
				local targetAnim = animator:LoadAnimation(chessTarget)
				targetAnim:Play()
				targetAnim:GetMarkerReachedSignal("updaterootpart"):Connect(function()
					target.HumanoidRootPart.CFrame = 
				end)
				targetAnim:GetMarkerReachedSignal("repeat"):Connect(function(TimePosition)
					targetAnim:AdjustSpeed(0)
					task.wait()
					AC:FireClient(player,target)
				end)

Would I start that way or, how would I go about it?

if animator then
	local chessTarget = game:GetService("StarterPlayer").StarterCharacterScripts:WaitForChild("CiaranChess").ChessTargetHit -- Replace with correct animation path
	local targetAnim = animator:LoadAnimation(chessTarget)
	targetAnim:Play()
	targetAnim:GetMarkerReachedSignal("updaterootpart"):Connect(function()
		while targetAnim.IsPlaying do
			target.HumanoidRootPart.CFrame = target.Torso.CFrame
			game:GetService("RunService").RenderStepped:Wait()
		end;
	end)
	targetAnim:GetMarkerReachedSignal("repeat"):Connect(function(TimePosition)
		targetAnim:AdjustSpeed(0)
		task.wait()
		AC:FireClient(player,target)
	end)

This is being run from a serverscript in which RenderStepped cant be used.

You can use Heartbeat instead!

1 Like

This did work, so thank you, however I ran into a new issue which I thought I would know how to fix but I guess not.

Since the HRP updates to the spot of the player during the animation, it just moves the animation a whole length further, basically flinging it into the void. I tried fixing this by anchoring the HRP and as a separate fix changing the walkspeed before the GetMarkerReachedSignal function.

Both did not solve my issue and the closest fix I found for it was deleting the GetMarkerReachedSignal and putting the code that was in between it into the repeat signal function as then since the players animation would be paused, maybe it wouldnt fling, and it doesnt but the player disappears right when it happens and oddly the chess piece slams at an angle.

Are you able to see the second clip I sent in the updated text above, if so, I can show you whats going on by making new clips.

You can re-upload the animation but half the length