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.
01 | local Parent = script.Parent |
02 | local Config = Parent.Config |
03 | local Enabled = Config.Enabled |
04 | local model = Parent |
05 |
06 |
07 |
08 | local function DoorAnimation() |
09 | if not Enabled.Value then |
10 | Enabled.Value = true |
11 | for i = 0 , 17 do |
12 | model:SetPrimaryPartCFrame(model:GetPrimaryPartCFrame() * CFrame.Angles( 0 , 0.1 , 0 )) |
13 | wait() |
14 | end |
15 | wait( 2 ) |
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:
1 | 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.