So I am trying to change the default running animation and for some reason my code doesn't work
game.Players.PlayerAdded:Connect(function(player)
playerCharacter = player.Character
ourPlayer = player
for i, v in pairs(playerCharacter.Humanoid:GetPlayingAnimationTracks()) do
v:Stop(0)
end
local AnimateScript = playerCharacter:WaitForChild("Animate")
for i, animation in pairs(AnimateScript:GetChildren()) do
print("ANIMATION: ", animation.Name)
end
AnimateScript.run.Value = "Run"
AnimateScript.run:FindFirstChild("RunAmin").AnimationId = "rbxassetid://<id>"
The value of run is changed but for some reason the last line of code here keeps giving me a "attempt to index a nil value". I honestly don't get why this is doesn't work, it seems so simple. All I want is to change the animation id. I know I could make a new Animation localscript but I really want this to work cause it would make things so much easier.

1 comment
youre old script was findfirstchild("RunAmin") im going to geuss you made a spelling error while searching for the animation.