How to change CFrame position but not angles?

Aloha. I am doing a thing where when a player dies, 4 cows spin around them and moo constantly. This is done by creating a model that has a center part where the player will be, and 4 cows surrounding it, welded to the primary part. I could do it the “correct” way and code out the cows spinning around the player individually, but this is ten times faster and does the exact same thing with less code.

It works but I realized that since I was moving the center part’s position, the cows wouldn’t move with it. You must use CFrame when moving objects if you want any object welded to it to move with it. I did this, but now the player’s rotation also accompanies the move. This isn’t usually an issue but the player is ragdoll’d while this his happening, so the cows might spin around vertically, diagonally, etc.

So how can I move the CFrame position of the center piece to bring the cows, but leave the rotation as 0,0,0?

What I used to do that moved the part but not the cows:

local cowRing = script.CowAssets.CowRing:Clone()
		cowRing.Parent = target.Character
		cowRing.Position = target.Character.HumanoidRootPart.Position

Here is code now, moves everything but angles are messed up:

local cowRing = script.CowAssets.CowRing:Clone()
		cowRing.Parent = target.Character
		cowRing.CFrame = target.Character.HumanoidRootPart.CFrame

Video of what should happen with the player in the middle

Try this instead

local cowRing = script.CowAssets.CowRing:Clone()
         cowRing.Parent = target.Character
         local charPosition = CFrame.new(target.Character.HumanoidRootPart.CFrame)
         local cowRotation = CFrame.Angles(cowRing.Orientation)
         cowRing.CFrame = charPosition * cowRotation
		cowRing.CFrame = cowRing.CFrame.Rotation + target.Character.HumanoidRootPart.Position
9 Likes

Beautiful. Thanks amigo, have a good late winter.