Something unexpectedly try to set the parent of?

This happens sometimes randomly where it will just throw a long list of this error and lags the whole server. I think the problem is due to changing the player into the zombie, by changing the players animation and changing its body to green?

    local R15 = humanoid.RigType == Enum.HumanoidRigType.R15

	local BodyColors = character:WaitForChild("Body Colors") 
	for _, property in next, {"HeadColor3", "LeftArmColor3", "RightArmColor3", "LeftLegColor3", "RightLegColor3", "TorsoColor3"} do
		BodyColors[property] = BrickColor.new("Bright green").Color
	end
	

    	spawn(function() 
    		if humanoid.RigType == Enum.HumanoidRigType.R6 then
    			local ls = character.Torso["Left Shoulder"]
    			local rs = character.Torso["Right Shoulder"]
    			ls.C0 = ls.C0 * CFrame.Angles(0, 0, -math.pi/2)
    			rs.C0 = rs.C0 * CFrame.Angles(0, 0, math.pi/2)
    		else
    			local ls = character.LeftUpperArm.LeftShoulder
    			local rs = character.RightUpperArm.RightShoulder
    			ls.C0 = ls.C0 * CFrame.Angles(math.pi/2, 0, 0)
    			rs.C0 = rs.C0 * CFrame.Angles(math.pi/2, 0, 0)
    		end
    	end)
    end
2 Likes

local BodyColors = character:WaitForChild("Body Colors")

I believe it is “BodyColors”. Maybe this could help?

You can also try Torso:WaitForChild("Left Shoulder")?

(also make sure humanoid is defined)

2 Likes

Try using Player.CharacterAppearanceLoaded:Wait(). Not certain if it’ll work.