Why am I getting this error?
Workspace.Oven.OvenDoor.Handle.Script:7: attempt to index field 'PrimaryPart' (a nil value)
local Handle = script.Parent local OvenDoor = Handle.Parent.OvenDoor function openOven() for i = 1, 12 do print("Opening...") OvenDoor:SetPrimaryPartCFrame(script.Parent.Parent.PrimaryPart.CFrame * CFrame.Angles(0, 0, math.rad(5))) wait() end end Handle.ClickDetector.MouseClick:connect(openOven)
You need to set the primary part for the model. You can do this one of two ways:
local Model = workspace.Model; Model.PrimaryPart = Model.SomePart;
Or, you can manually set it: