I want to make this if then statement occur if the scripts math.random chooses "animation1"
local anims = {script.Animation1,script.Animation2}
local chooseattack = math.random(2) local animation = hum:LoadAnimation(anims[chooseattack]) --this will load a random animation, from the array, into the player animation:Play() -- plays it if animation == 1 then
I think I understand what you're saying, but I'm not positive; is this what you mean?
local anims = { script.Animation1; script.Animation2; } local attack = math.random(2); local animation = hum:LoadAnimation(anims[attack]); animation:Play(); if(attack == 1)then -- the chosen attack was the first in the array anims -- that means that the animation chosen was script.Animation1 end