Setting CFrame of Torso goes to random position

Hello, I have an animation, and after it’s over, I would like to set the player to go back to where the animation ends. But instead, the torso’s CFrame simply goes to a random position. I have no idea why this happens, all I know is that it goes to a random position the same distance as it’s supposed to go from a center point, but at a random angle. If anyone has any ideas as to why this may happen or a possible solution, I would appreciate it!


				ehum:LoadAnimation(anims.Countering):Play()
				hum:LoadAnimation(anims.CounterHit):Play()--this is the animation that happens on the player
				task.wait(1.7)
				local keep = char.Torso.CFrame --this variable sets to the cframe of the player's torso when they're on the ground
				hum:TakeDamage(40)
				task.wait(1)
				
				char.smoothcam.Enabled = true
				game.ReplicatedStorage.ShiftLock:FireClient(game:GetService("Players"):GetPlayerFromCharacter(hum.Parent),true)
				strv:Destroy()
				
				char.Torso.CFrame = keep --after the animation is over, I would like to set the torso back to the cframe set before

Use character:PivotTo() or set the CFrame of the Head or HumanoidRootPart. It’s most likely that. Roblox sometimes just acts weird with certain CFrame modifications, especially in the character.

I’ve found that editing CFrame or Position of any individual body part is buggy for me. Try using HumanoidRootPart instead if trying to save location data

For setting character position use PrimaryPart.CFrame or set CFrame of all parts in the same time which worked in my game very well when I had the same problem.

  1. For your initial problem, you put the “keep” CFrame after a wait() function, which is what may be causing your problem.

  2. You don’t set a character’s CFrame, Position or Rotation using torso, you use the HumanoidRootPart or with a CFrame you can do Character:PivotTo(yourCFrame)

  3. You load animations on player characters using an animator, which is a child of the Humanoid, you can read about it here: Animator