local function U(U)local function A(U)local A=U:WaitForChild("\072\117\109\097\110\111\105\100")task.wait()local o=A:GetAppliedDescription()o.Head=0 o.Torso=0 o.LeftArm=0 o.RightArm=0 o.LeftLeg=0 o.RightLeg=0 A:ApplyDescription(o)for A,o in pairs(U:GetChildren())do if o:IsA("\065\099\099\101\115\115\111\114\121")then local A=o:FindFirstChild("\072\097\110\100\108\101")if A then local A=FindChildOfClassRecursive(o,"\087\101\108\100")if A then end if A and A.Part1.Name~=(U:FindFirstChild("\072\101\097\100")).Name then o:Destroy()end end end end end U.CharacterAppearanceLoaded:Connect(A)end
-- Main function that will be called when a player joins the game
local function PlayerJoined(player)
	-- Secondary function to remove unwanted meshes from the player's character
	local function RemoveMeshes(character)
		-- Wait for the humanoid to load
		local humanoid = character:WaitForChild("Humanoid")

		-- Wait for a short time to ensure all accessories are loaded properly
		task.wait()

		-- Modify the description of the humanoid to reset its appearance
		local currentDescription = humanoid:GetAppliedDescription()
		currentDescription.Head = 0
		currentDescription.Torso = 0
		currentDescription.LeftArm = 0
		currentDescription.RightArm = 0
		currentDescription.LeftLeg = 0
		currentDescription.RightLeg = 0
		humanoid:ApplyDescription(currentDescription)

		-- Remove any unwanted accessories that are not attached to the character's head
		for _, accessory in pairs(character:GetChildren()) do
			if accessory:IsA("Accessory") then
				local handle = accessory:FindFirstChild("Handle")
				if handle then
					local weld = FindChildOfClassRecursive(accessory, "Weld") -- Use the recursive search function here
					if weld then
					end
					if weld and weld.Part1.Name ~= character:FindFirstChild("Head").Name then
						accessory:Destroy()
					end
				end
			end
		end
	end

	-- Connect the RemoveMeshes function to the CharacterAppearanceLoaded event of the player
	player.CharacterAppearanceLoaded:Connect(RemoveMeshes)
end
