Need help with Model:SetPrimaryPartCFrame()

Hi, I’m working on making some tanks for a game of mine, and I’m using SetPrimaryPartCFrame() to move the turret, however it will not work.

The error:
Model:GetPrimaryPartCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this. - Server - Script:4

The thing is I do have a PrimaryPart in my model.
image

My current code:

local Model = script.Parent

for i = 0, 1, 0.01 do
	Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.new(1, 5, i))
	wait(1)
end

Please help!

Have you set “PrimaryPart” as the Primary part for the model?
image

5 Likes

Thank you so much! This now works and I can get back to working on my tank!

:grinning:

1 Like