local T=Rigs[0]local function N(N)local e=N:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if not e or e.Health<=0 or e.RigType~=Enum.HumanoidRigType.R15 then return end e:UnequipTools()local E=Rigs[RigVersion]if IgnoreBodyParts then for T,E in pairs(E:GetDescendants())do if N:FindFirstChild(E.Name)and E:IsA("\066\097\115\101\080\097\114\116")then e:ReplaceBodyPartR15(E.Name,E:Clone())end end else for N,Z in pairs(N:GetChildren())do if Z:IsA("\077\101\115\104\080\097\114\116")then local N=T:FindFirstChild(Z.Name)local G=E:FindFirstChild(Z.Name)if N and(G and N.MeshId==Z.MeshId)then e:ReplaceBodyPartR15(Z.Name,G:Clone())end end end end end local function e(T)T.CharacterAppearanceLoaded:Connect(N)end;(game:GetService("\080\108\097\121\101\114\115")).PlayerAdded:Connect(e)

local DefaultRig = Rigs[0]

local function Update(Character)
	local Humanoid = Character:FindFirstChildOfClass("Humanoid")
	if not Humanoid or Humanoid.Health <= 0 or Humanoid.RigType ~= Enum.HumanoidRigType.R15 then return end
	Humanoid:UnequipTools()
	
	local ConvertTo = Rigs[RigVersion]
	
	if IgnoreBodyParts then
		for _, Part in pairs(ConvertTo:GetDescendants()) do
			if Character:FindFirstChild(Part.Name) and Part:IsA("BasePart") then
				Humanoid:ReplaceBodyPartR15(Part.Name, Part:Clone())
			end
		end
	else
		for _, Part in pairs(Character:GetChildren()) do
			if Part:IsA("MeshPart") then
				local EquivalentDefault = DefaultRig:FindFirstChild(Part.Name)
				local EquivalentSkinned = ConvertTo:FindFirstChild(Part.Name)
				if EquivalentDefault and EquivalentSkinned and EquivalentDefault.MeshId == Part.MeshId then
					Humanoid:ReplaceBodyPartR15(Part.Name, EquivalentSkinned:Clone())
				end
			end
		end
	end
end

local function PlayerJoined(Player)
	Player.CharacterAppearanceLoaded:Connect(Update)
end


game:GetService("Players").PlayerAdded:Connect(PlayerJoined)
