SetPrimaryPartCFrame() Error Even Though Primary Part has been Set

Hello, I am trying to rotate a model, but I get this error
Model:GetPrimaryPartCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.
The thing is, I have set the primary part
image

-- this is a localscript inside StarterPlayerScripts

local RunService = game:GetService("RunService")
local model = workspace:WaitForChild("BrownShrooms1")

while true do
	model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame()*CFrame.fromEulerAnglesXYZ(math.rad(1),0,0))
	RunService.Stepped:Wait()
end

What could be the problem?

Thanks :slight_smile:

These functions have been replaced with :GetPivot() and :PivotTo() so please consider changing your script to:

-- this is a localscript inside StarterPlayerScripts

local RunService = game:GetService("RunService")
local model = workspace:WaitForChild("BrownShrooms1")

while true do
	model:PivotTo(model:GetPivot()*CFrame.Angles(math.rad(1),0,0))
	RunService.Stepped:Wait()
end

(For these functions you don’t need a PrimaryPart anymore)

4 Likes