local FALL_ANIM_NEW = 'http://www.roblox.com/asset/?id=344065810'
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local animateScript = character:WaitForChild("Animate")
local fall = animateScript:WaitForChild("fall")
local FallAnim = fall:WaitForChild("FallAnim")
FallAnim.AnimationId = FALL_ANIM_NEW
end)
end)
This is a fall animation, obviously when a player falls, this animation plays.. but what if I made multiple fall animations (and I did) and I want this script to randomly pick one when a player falls?
---------------------UPDATED VERSION OF ORIGIN SCRIPT (NEED HELP ON IT)-----------------
(Not mine)
local FallAnimations = {344065810, 355981334}
local FALL_ANIM_NEW = 'http://www.roblox.com/asset/?id='
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local animateScript = character:WaitForChild("Animate")
local fall = animateScript:WaitForChild("fall")
local FallAnim = fall:WaitForChild("FallAnim")
FallAnim.AnimationId = FALL_ANIM_NEW .. FallAnimations[math.random(#FallAnimations)]
end)
end)
Now that I've added two, how come when my player falls the script automatically (all the time) chooses the second one and don't switch up?

1 comment
https://scriptinghelpers.org/questions/7236/what-does-do # Gives you the length of a table or string.