Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can i make an animation randomizer?

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

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.

8 comments

0

could u give me the script?

0

Yeah, wait

0

k thx

0

gone wrong

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

0

The script in my comment should work

0

:<

0

What's the error?

This discussion is preserved as it was. New answers, comments, and votes are closed.