I am trying to make it so that the player could equip a halo, but every time I try to equip a halo I get the error: "Parent cannot be assigned to" I don't know what could be causing the issue. Here is the server script:
local function equipHalo(plr,color) if plr.HaloInventory:FindFirstChild(color.."Halo") == nil then return "halo" end if plr.HaloInventory:FindFirstChild(color.."Halo") then local clone = game.ReplicatedStorage.Halos[color.."Halo"]:Clone() local char = plr.Character if clone ~= nil and char ~= nil then if char:FindFirstChild(plr.Name.."'s Halo") then char[plr.Name.."'s Halo"]:Destroy() end clone.Name = plr.Name.."'s Halo" clone.CFrame = char.Head.CFrame local size = clone.Size local attatchmentchar = Instance.new("Attachment") attatchmentchar.Visible = false attatchmentchar = Vector3.new(0,2.5,0) + size attatchmentchar.Parent = char:WaitForChild("HumanoidRootPart") local attatchmenthalo = Instance.new("Attachment") attatchmenthalo.Visible = false attatchmenthalo.Parent = clone local alignposition = Instance.new("AlignPosition") alignposition.MaxForce = 25000 alignposition.Attachment0 = attatchmenthalo alignposition.Attachment1 = attatchmentchar alignposition.Responsiveness = 200 alignposition.Parent = clone local alignorientation = Instance.new("AlignOrientation") alignorientation.MaxTorque = 25000 alignorientation.Attachment0 = attatchmenthalo alignorientation.Attachment1 = attatchmentchar alignorientation.Responsiveness = 200 alignorientation.Parent = clone clone.Parent = char return "yes" end end end game.ReplicatedStorage.Remotes.EquipHalo.OnServerInvoke = equipHalo
I mean you can make it as an accessory its way easier. But about your script I think its the Halo because I think the Halo is a model which can't be parented with an Attachment it should be a Basepart. But I recommend making it as an accessory and cloning it to the character.
I just realized on line 15:
attatchmentchar = Vector3.new(0,2.5,0) + size
I was setting the Instance instead of the position. Thanks for your effort!