Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make an animation randomizer?

Asked by 7 years ago

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?

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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.

0
could u give me the script? Nonglolprogames -19 — 7y
0
Yeah, wait User#20388 0 — 7y
0
k thx Nonglolprogames -19 — 7y
0
gone wrong Nonglolprogames -19 — 7y
View all comments (4 more)
0
my lightsaber works if i click then it slashes the same animation, s can u give me a script? i hope this will work Nonglolprogames -19 — 7y
0
The script in my comment should work User#20388 0 — 7y
0
:< Nonglolprogames -19 — 6y
0
What's the error? User#20388 0 — 6y
Ad

Answer this question