Changing Animations with LoadCharacterAppearance()

Hello! I am having some trouble changing animations for my character after setting values to it. Part of my script is from the Developer Hub:

local Players = game:GetService("Players")

local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")
    
	for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingTracks:Stop(0)
	end
 	
	local animateScript = character:WaitForChild("Animate")
	wait(1)
	animateScript.run.RunAnim.AnimationId = "rbxassetid://616010382"        -- Run
	animateScript.walk.RunAnim.AnimationId = "rbxassetid://616013216"      -- Walk
	animateScript.jump.JumpAnim.AnimationId = "rbxassetid://616008936"      -- Jump
	animateScript.idle.Animation1.AnimationId = "rbxassetid://616006778"    -- Idle (Variation 1)
	animateScript.idle.Animation2.AnimationId = "rbxassetid://616008087"    -- Idle (Variation 2)
	animateScript.fall.FallAnim.AnimationId = "rbxassetid://616005863"      -- Fall
	animateScript.swim.Swim.AnimationId = "rbxassetid://616011509"          -- Swim (Active)
	animateScript.swimidle.SwimIdle.AnimationId = "rbxassetid://616012453"  -- Swim (Idle)
	animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://616003713"    -- Climb
end
 
local function onPlayerAdded(player)
	player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end
 
Players.PlayerAdded:Connect(onPlayerAdded)

What I want to have happen is to turn it into this…

local Players = game:GetService("Players")

local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")
    local player = game.Players:GetPlayerFromCharacter(character)
    local anim = player.PlayerAnim.Value
	for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
		playingTracks:Stop(0)
	end
 if anim == "DefaultAnim" then	
	local animateScript = character:WaitForChild("Animate")
	wait(1)
	animateScript.run.RunAnim.AnimationId = "rbxassetid://616010382"        -- Run
	animateScript.walk.RunAnim.AnimationId = "rbxassetid://616013216"      -- Walk
	animateScript.jump.JumpAnim.AnimationId = "rbxassetid://616008936"      -- Jump
	animateScript.idle.Animation1.AnimationId = "rbxassetid://616006778"    -- Idle (Variation 1)
	animateScript.idle.Animation2.AnimationId = "rbxassetid://616008087"    -- Idle (Variation 2)
	animateScript.fall.FallAnim.AnimationId = "rbxassetid://616005863"      -- Fall
	animateScript.swim.Swim.AnimationId = "rbxassetid://616011509"          -- Swim (Active)
	animateScript.swimidle.SwimIdle.AnimationId = "rbxassetid://616012453"  -- Swim (Idle)
	animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://616003713"    -- Climb
end
end
 
local function onPlayerAdded(player)
	player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end
 
Players.PlayerAdded:Connect(onPlayerAdded)

The problem is, by the time I assign the PlayerAnim Value and all the other stuff to the player (in another part of the script), this line has already fired

player.CharacterAppearanceLoaded:Connect(onCharacterAdded)

I thought of putting in LoadCharacterAppearance() but it says it is depreciated, and I am getting errors.
Any thoughts?