Custom Character Animations Not Playing

I am trying to use custom animations for a custom character I made but the animations do not play.

I have this script running in ServerScriptService:

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")
    animateScript.walk.WalkAnim.AnimationId = "rbxassetid://7891989420"      -- Walk
    animateScript.jump.JumpAnim.AnimationId = "rbxassetid://7892225376"      -- Jump
end

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

Players.PlayerAdded:Connect(onPlayerAdded)

I tried using the animations in a different way by copying the default Animate script, adding it to the StarterCharacter in StarterPlayer, and changing the id’s to my custom animations but when I tested it the script had been reset to the default one in my character.

Here’s the custom character I’m using.

1 Like

I would suggest doing it in StarterCharacter and changing the ID in the values and the script. It worked for me.

1 Like

You mean putting the default Animate script into StarterCharacter?

1 Like

yes. You just need to set the values parented to the script and the values in the script

1 Like

Tried it but it doesn’t seem to work. Here’s what I did.

1 Like

I use this (R6) and it works for me. Put it in StarterCharacter or StarterCharacterScripts. Animate - Roblox

1 Like

I replaced the Walk and Jump ids but it still does not work with my custom character. I tried putting it in the StarterCharacter and StarterCharacterScripts but neither of them worked.

1 Like

Well this is confusing me too now :I

1 Like

So it works on your end though? The character does the animations?

1 Like

Yes it does work. Have you tried a normal character just for a check if the Animate script works in StarterCharacterScripts at all?

1 Like

It definitely seems to have overridden the walk and jump animations because when just using the regular character it stays still when doing those actions (I assume because it’s meant for a different rig it doesn’t know what to do?) so I guess it’s doing something.

1 Like

Yes my scripts is for R6. So this means that the issue lies with you character model? Can it play animations at all?

1 Like

If I use this Local Script by GnomeCode in StarterCharacterScripts:

-- Very basic walking animation script by GnomeCode
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

-- Remeber to select the animtion object and set the id to your own!
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)

humanoid.Running:Connect(function(speed)
	if speed > 0 then
		if not walkAnimTrack.IsPlaying then
			walkAnimTrack:Play()
		end
	else
		if walkAnimTrack.IsPlaying then
			walkAnimTrack:Stop()
		end
	end
end)

and put an animation as a child named Walk with the id in it the animation plays.

Interesting… You could try expanding this script to include the other animations.

I was trying to use the other script because I have no clue how I would expand on this for other animations.

So you said you got it working on your end. Could you upload the model with the script so I can compare it to what I’m doing? Just to make sure.

-- Very basic walking animation script by GnomeCode
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

-- Remeber to select the animtion object and set the id to your own!
local walkAnim = script:WaitForChild("Walk")
local walkAnimTrack = humanoid.Animator:LoadAnimation(walkAnim)

humanoid.Running:Connect(function(speed)
	if speed > 0 then
		if not walkAnimTrack.IsPlaying then
			walkAnimTrack:Play()
		end
	else
		if walkAnimTrack.IsPlaying then
			walkAnimTrack:Stop()
		end
	end
end)

humanoid.Climbing:Connect(function(speed)
	--perform climbing anim here
end)

humanoid.Jumping:Connect(function(bool)
	--perform jumping anim here
end)

That script is fairly simple to add to, just do like I, in the above.

2 Likes

Thanks! It works! It seems I also forgot to save my animation priority as movement. The script did not work until then even though I thought I had set it as movement it must not have saved. Good to know for the future!

How would I do an Idle Animation on this?