well, i suck at math.random so i built a lightsaber and welded it but i onli can do 1 animation. i made 4 anims for slashes and 1 for idle. how can i get the idle anim continously and the 4 slash anims random if i click?
COMMUNITY QUESTION
How can i make an animation randomizer?
1 answer
You could use math.random(1,4), this will select a number from 1 to 4 and then detect wich one is selected and use that animation (it printed 3 so it will activate your third animation)
slash = 0
repeat -- change this to when they use the lightsaber
wait()
slash = math.random(1,4)
if slash == 1 then
print("1")
--animation1
elseif slash == 2 then
print("2")
--animation2
elseif slash == 3 then
print("3")
--animation3
elseif slash == 4 then
print("4")
--animation4
end
until false
Should be pretty easy, I don't know how your lightsaber works so the animations you have to execute yourself as well as the trigger.
This discussion is preserved as it was. New answers, comments, and votes are closed.

8 comments
could u give me the script?
Yeah, wait
k thx
gone wrong
my lightsaber works if i click then it slashes the same animation, s can u give me a script? i hope this will work
The script in my comment should work
:<
What's the error?