How to rotate model using another model

I am trying to rotate Y axis orientation of m model to the same Y axis orientation of f model
error Unable to cast bool to CoordinateFrame

	local m = game.Workspace.Modelz
	local f = game.Workspace.Modelb
	local a, u, c = f:GetPivot():ToOrientation()
	local Orientationb	= math.deg(u)
	local W, T, H = m:GetPivot():ToOrientation()
	local OrientationT	= math.deg(T)
	m:PivotTo( == Orientationb)

what are you even trying to do here? is this the line of code that is giving you the error?

m:PivotTo(m:GetPivot() * CFrame.Angles(0,u,0))

my guess, I didnt understand what u meant

1 Like

Both parts are Locked and Anchored …

local p1 = workspace:WaitForChild("Part_1") -- .PrimaryPart -- for a model
local p2 = workspace:WaitForChild("Part_2") -- .PrimaryPart -- for a model
local rs = game:GetService("RunService") 
local s1 = 0.03699125043077515

while rs.Stepped:Wait() do
	p1.CFrame *= CFrame.fromEulerAnglesXYZ(0, s1, 0)
	p2.Orientation = p1.Orientation -- +,90,0) -- for an offset

This is super smooth and can do very slow rotations if needed.
For a model the PrimaryPart needs to be set to the part inside.
(click on PrimaryPart in the model’s Properties window then click on the part inside)

Sorry for the confusion, but this fixed it Thanks you!!

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