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

Error code. Can not understand. ???lllllllllllllllllllllllllllllllll

I have an error, I do not know how to solve it. Help me please.

The error itself:

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

local Parent = script.Parent
local Config = Parent.Config
local Enabled = Config.Enabled
local model = Parent



local function DoorAnimation()
	if not Enabled.Value then
		Enabled.Value = true
		for i = 0, 17 do
			model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(0, 0.1, 0))
			wait()
		end
		wait(2)
		for i = 0, 17 do
		model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles(0, 0.1, 0))
			wait()
		end
		Enabled.Value = false
	 	end
	end
Config.DetectEvent.OnServerEvent:Connect(DoorAnimation)

1 comment

0

is this on roblox studio?

1 answer

✓ Accepted answer

As far as I can tell, your code is fine but you haven't set the PrimaryPart in your model, you can either do this in your code:

model.PrimaryPart = model.A_Part

or, you can set it manually in the workspace by clicking on your model, and where it says Primary Part in properties, click that and then a Part in your model.

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