Custom player animation not working

I made an custom player animation, which isnt working. The animation is uploaded by me, its set to movement, the script is present in the server script.
The video:
robloxapp-20220223-1536018

The script:




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")     
	animateScript.walk.WalkAnim.AnimationId = "rbxassetid://8911048329"      -- Walk


	local function onPlayerAdded(player)
		player.CharacterAppearanceLoaded:Connect(onCharacterAdded)	
	end


	Players.PlayerAdded:Connect(onPlayerAdded)
end

You’re connecting the events in the wrong scopes. You should be connecting the PlayerAdded event OUTSIDE the scope first, THEN you connect the CharacterAdded event with the function.

so i put the character added in player added?

i tried fixing the script, idk where i went wrong.

local Players = game:GetService("Players")


local function onPlayerAdded(player)
	local function onCharacterAdded(character)
		player.CharacterAppearanceLoaded:Connect(onCharacterAdded)	
		local humanoid = character:WaitForChild("Humanoid")

		for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
			playingTracks:Stop(0)
		end

		local animateScript = character:WaitForChild("Animate")     
		animateScript.walk.WalkAnim.AnimationId = "rbxassetid://8911048329"      -- Walk

	end
end

Players.PlayerAdded:Connect(onPlayerAdded)```
local Players = game:GetService("Players")


local function onPlayerAdded(player)
    player.CharacterAppearanceLoaded:Connect()	
        local character = player.Character
		local humanoid = character:WaitForChild("Humanoid")

		for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
			playingTracks:Stop(0)
		end

		local animateScript = character:WaitForChild("Animate")     
		animateScript.walk.WalkAnim.AnimationId = "rbxassetid://8911048329"      -- Walk 
    end)
end

Players.PlayerAdded:Connect(onPlayerAdded)

try this

remove the extra “end?”, tried it but i always get this error
Player:Move called, but player currently has no humanoid.

Try using player.CharacterAdded instead.

Edit: make sure to use the character parameter inside of the CharacterAdded event:

player.CharacterAdded:Connect(function(character))

Then use the character parameter to get the humanoid.

walk is not a valid member of Script “killeraman6.Animate” - error, everything else is fine but the animate script in the player during the game is disable and no contents are there in it.