I am pivoting a model to a CFrame value but it changes the rotations of all the individual parts inside of the model:
Wrong:
Correct:
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