Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

2 comments

0

If the car is cloned from elsewhere, you can set its PrimaryPart in the Property editor on Studio.

0

Thanks man

This discussion is preserved as it was. New answers, comments, and votes are closed.