Pivoting model messes with part rotation

I am pivoting a model to a CFrame value but it changes the rotations of all the individual parts inside of the model:
Wrong:
image
Correct:
image
script that sets the cframe:

local placeHolder = game.ReplicatedFirst[obj]:Clone()
placeHolder.Owner.Value = player.Name
placeHolder:PivotTo(CF)
for i,v in pairs(placeHolder:GetChildren())do
	if v:IsA("MeshPart")then
		v.Anchored = true
		v.CanCollide = false
		v.BrickColor = team.TeamColor
	end
end

this is how im getting the cframe:

local raycastParams = RaycastParams.new()
	raycastParams.FilterType = Enum.RaycastFilterType.Exclude
	raycastParams.FilterDescendantsInstances = excluding
	local ray = workspace:Raycast(humRP.Position,origin,raycastParams)
	local CF = CFrame.fromMatrix(
		ray.Position,
		ray.Normal:Cross(humRP.CFrame.RightVector),
		humRP.CFrame.RightVector,
		ray.Normal)*CFrame.Angles(math.rad(90),rotation,0)

any help is appreciated

What I usually do is unanchor every part except one, and weld all of them together. Just move one and it should move all together.

1 Like

PVInstances must have a Primary Part. Make sure to check that it is assigned.

1 Like

this works, so does doing this

placeHolder:PivotTo(CFrame.new(CF.Position)*CFrame.fromEulerAnglesXYZ(CF.ToEulerAnglesXYZ(CF))
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.