My character is not morphing for some reason

I’m trying to make a player morph but for a specific rank (haven’t added that yet) but it’s not working for some reason. There are no errors in the output. Heres the script:

local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

function PlayerJoined(Player)
	local Cadet = ServerStorage.Cadet:Clone()
	local function RemoveMeshes(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		wait()

		local CurrentDescription = Humanoid:GetAppliedDescription() -- gets the current applied description
		-- changes all of the body parts description to 0 (default)
		CurrentDescription.Head = 0
		CurrentDescription.Torso = 0
		CurrentDescription.LeftArm = 0
		CurrentDescription.RightArm  = 0
		CurrentDescription.LeftLeg = 0
		CurrentDescription.RightLeg = 0
		Humanoid:ApplyDescription(CurrentDescription) -- we only changes the body parts so the rest stays the same

		for b,a in pairs(Character:GetChildren()) do
			if a:IsA("Shirt") or a:IsA("Pants") or a:IsA("Accessory") or a:IsA("ShirtGraphic") then
				a:Destroy()
			end
		end
		for b,a in pairs(Cadet:GetChildren()) do
			if a:IsA("Shirt") or a:IsA("Pants") or a:IsA("Accessory") or a:IsA("ShirtGraphic") then
				a.Parent = Player.Character
			end
		end

	end
	Player.CharacterAppearanceLoaded:Connect(RemoveMeshes)
end

Players.PlayerAdded:Connect(PlayerJoined)

here’s the model I’m trying to morph it to:
StormTrooper.rbxm (129.3 KB)

The issue may just be that you are joining the server just before this function is able to setup to listen for changes, you should always do this for playeradded event:

Players.PlayerAdded:Connect(PlayerJoined)
for _,player in pairs(game.Players:GetChildren()) do
    PlayerJoined(player)
end

This ensures your function gets called on players that were already “added” when the :connect was setup :+1:

The thing is the clothes get cloned to the player but the helmet doesn’t because the parts of the helmet are inside the stormtroopers helmet so. How do I change the players head to the head on the stormtrooper? When I try to do that it just kills the player.

You aren’t including “Hat” in your classnames list of things to copy to the player.

Well yes, but the meshes for the hat are inside morphs head.