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

game.Players.PlayerAdded:Connect(function(plr)
	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(CFrame.new(m:GetPivot().Position) == Orientationb)
	task.wait()
		print(OrientationT)
		
end)

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 -- + Vector3.new(0,90,0) -- for an offset
end

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.