Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Model:SetPrimaryCFrame() failed because no PrimaryPart has been set?

Asked by
imaA6D 39
14 days ago
Edited 14 days ago

I don't understand this error, nor do I know how to fix my script. I tried finding ways to fix this for nearly 3 hours and got nothing. Any help please?

Full Error: Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.

local test = part.CFrame

car:SetPrimaryPartCFrame(test)

local pos = test * CFrame.Angles(0, math.rad(180), 0)

car:SetPrimaryPartCFrame(pos)


car:MakeJoints()

1 answer

Log in to vote
1
Answered by
Sparks 534 Moderation Voter
14 days ago
Edited 14 days ago

You are using Model:SetPrimaryPartCFrame() before setting the PrimaryPart. Models have a PrimaryPart property, which you need to set before calling methods like SetPrimaryPartCFrame and MoveTo() on the model.

local test = part.CFrame

car.PrimaryPart = primaryparthere

car:SetPrimaryPartCFrame(test)

local pos = test * CFrame.Angles(0, math.rad(180), 0)

car:SetPrimaryPartCFrame(pos)


car:MakeJoints()

You need to replace "primaryparthere" with a part that the rest of the model will use as a basis for positioning. Preferably, this is a part at or near the center. I usually set an invisible part in the center as the PrimaryPart.

0
If the car is cloned from elsewhere, you can set its PrimaryPart in the Property editor on Studio. Sparks 534 — 14d
0
Thanks man imaA6D 39 — 14d
Ad

Answer this question