Error: Model:SetPrimaryPartCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.
local RS = game:GetService("ReplicatedStorage") local Events = RS.Events local Pets = RS.Pets local PetCreate = Events.PetCreate local tab = {} function CreatePet(player, Index) local character = player.Character or player.CharacterAdded:Wait() if character.PrimaryPart:FindFirstChild("Attachment") then character.PrimaryPart:FindFirstChild("Attachment"):Destroy() end local Pet = Pets[Index]:Clone() local AttachA = Instance.new("Attachment") AttachA.Parent = Pet.PrimaryPart local AttachB = Instance.new("Attachment") AttachB.Position = Vector3.new(3,3,0) AttachB.Parent = character.PrimaryPart local AlignPosition = Instance.new("AlignPosition") AlignPosition.Attachment0 = AttachA AlignPosition.Attachment1 = AttachB local AlignOrientation = Instance.new("AlignOrientation") AlignOrientation.Attachment0 = AttachA AlignOrientation.Attachment1 = AttachB AlignPosition.MaxForce = 30000 AlignOrientation.MaxTorque = 30000 AlignPosition.Parent = Pet.PrimaryPart AlignOrientation.Parent = Pet.PrimaryPart Pet:SetPrimaryPartCFrame(character.PrimaryPart.CFrame) Pet.Parent = workspace tab[player] = Pet end PetCreate.OnServerEvent:Connect(function(player,Index) if not tab[player] then CreatePet(player, Index) else local prevPet = tostring(tab[player]) tab[player]:Destroy() tab[player] = nil if prevPet ~= Index then CreatePet(player, Index) end end PetCreate:FireClient(player, tab[player]) end)
in the model properties is category named primarypart. click on it and select part that you want to be primary part and it will work. it is good at placement etc. it is recommended to be part that touches all parts in model :)