I want to make a random animation inside a folder play everytime the animation is played.
Does anyone know how to do this?
My attempt of doing it
local animationsTable = {6275642178,6275642678,6275643039,6275643430,6275643820}
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://"..(math.random(1, #animationsTable))
local playAnim = m.Humanoid:LoadAnimation(anim)
1 Like
heII_ish
(heII_ish)
January 20, 2021, 11:51pm
#2
Questions like this have been answered many times already
anim.AnimationId = "rbxassetid://"..animationsTable[math.random(#animationsTable)]
5 Likes
heII_ish
(heII_ish)
January 21, 2021, 12:00am
#4
No you don’t, if there is only one argument passed then it will just assume the range starts at 1
1 Like
Oh thanks, I didn’t know that.
You never played the animation
local animationsTable = {6275642178,6275642678,6275643039,6275643430,6275643820}
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://"..animationsTable[math.random(#animationsTable)]
local playAnim = m.Humanoid:LoadAnimation(anim)
playAnim:Play() -- play it
1 Like
Thank you, your script fixed the issue I was having. Appreciate it!
This help me when making my tool