Need Help With Fixing Animations

(Sorry for posting like everyday lol)

Here’s the code

local Humanoid = script.Parent:WaitForChild("Humanoid")
local RunAnimation = Instance.new("Animation")
RunAnimation.AnimationId = {"5714097257","5714126840"}
local RandomAnimation = Humanoid:LoadAnimation()

local SV = RunAnimation[math.random(5, #RunAnimation )]
RandomAnimation = (SV)

It wants me to covert my table into a string, I have no idea how to do that.

Thanks for any help! : D

You have to put in 1 animationId as a string and not a table.If you want to have multiple animations, you have to create two animations with the two Id’s.

1 Like

By the way, the format for asset ids rbxassetid:// with your ID after it.

1 Like

Yeah, but I have no idea how to do strings. ;/

Oh right, that’s my bad lol. : /

just do

local Humanoid = script.Parent:WaitForChild("Humanoid")
local RunAnimation1 = Instance.new("Animation")
local RunAnimation2 = Instance.new("Animation")
RunAnimation1.AnimationId = "rbxassetid://5714097257"
RunAnimation2.AnimationId = "rbxassetid://5714126840"

local RandomAnimation = Humanoid:LoadAnimation()

local SV = RunAnimation[math.random(5, #RunAnimation )]
RandomAnimation = (SV)

You have to say which animation you want to load with LoadAnimation()

1 Like

image

I assume now it has something to do with the local SV because “RunAnimation” now doesn’t exist.

Yes indeed, I want to talk a little bit more because length post

1 Like

Oh alright, I can stick around for a bit.

no that post was because 30 caracters

Oh, sorry. I haven’t really been on the devforum lately till now.

This should fix it:

local RunAnimation1 = youranimplace
local RunAnimation2 = youranimplace

RunAnimation1.AnimationId = "rbxassetid://5714097257"
RunAnimation2.AnimationId = "rbxassetid://5714126840"

local RandomAnimation = Humanoid:LoadAnimation(RunAnimation1)

local RandomAnimation2 = Humanoid:LoadAnimation(RunAnimation2)

Make sure to play the anims

You have to use Humanoid:LoadAnimation() and put the animation within those parenthesis,

local Animations = {
          RunAnimation1 = Instance.new("Animation", script.Parent);
          RunAnimation2 = Instance.new("Animation", script.Parent);       
};

Animations.RunAnimation1.AnimationId = "rbxassetid://idhere";
Animations.RunAnimation2.AnimationId = "rbxassetid://idhere";

local RandomAnimation = Humanoid:LoadAnimation(Animations[math.random(1, 2)]);
1 Like

I’ve been trying a lot of different things using your script, but I keep getting this issue :
image