Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
imaA6D 39
4 years ago
Edited 4 years 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
4 years ago
Edited 4 years 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 — 4y
0
Thanks man imaA6D 39 — 4y
Ad

Answer this question