Hopefully I worded my title right.
So basically I have a register system so that if player leaves, the NPC is destroyed while in the process of going to the register but i keep getting this error and I want to get rid of it.
Model:GetPrimaryPartCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.
local dummy = randomRig
local cframe = Instance.new("CFrameValue")
if not dummy:GetPrimaryPartCFrame() then
return
else
cframe.Value = dummy:GetPrimaryPartCFrame()
cframe.Changed:Connect(function(value)
dummy:SetPrimaryPartCFrame(value)
end)
end
read the error first. it says “no PrimaryPart has been set”. means the PrimaryPart of the model you are calling is not set or doesn’t exist or has been destroyed. from your code im guessing “Dummy” is a basic roblox rig and has a HumanoidRootPart, you should set the HumanoidRootPart as the PrimaryPart and you should be good to go.