How do you rotate a model and set primary part?

title says it all ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.

use the models PrimaryPartCFrame times an angle.

local UIS = game:GetService("UserInputService")
local model = --model here

UIS.InputBegan:Connect(function(input,typing)
	if not typing then
		if input.KeyCode == Enum.KeyCode.R then
			model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(90,0,0))
		end
	end
end)

Of course, you will probably need to do more checks if it is for building or in a specific scenario

1 Like

Ignore the button part, I know that part although I’m unsure how to rotate the part and when I use the above code it errors “Model:GetPrimaryPartCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this” - I do not know how to set the primary part, could you send another example

setprimarypartcframe and getprimarypartcframe are deprecated you should use PivotTo() and GetPivot()

got to the model in properties and scroll to the pivot section, it should say PrimaryPart, click on it then click on the part of the model you want the primary part of the model to be.

using pivotto is weird sometimes. i use setprimarypartcframe if i wanna make a model go to an exact position

would moveto do the same as setprimarypartcframe too?