Forum

> > CS2D > Scripts > Number randomly select
Forums overviewCS2D overview Scripts overviewLog in to reply

English Number randomly select

5 replies
To the start Previous 1 Next To the start

old Number randomly select

phalenkO
User Off Offline

Quote
Hi everyone

Its topic entered the my mind and can I ask the questions? I not tried the that questions.

Firstly or last, How to number randomly select? Its same spin and that spin select the randomly number. I wants defined number to ID.
1
math.random(1,32)
I founde the that but how to I using, idk.

old Re: Number randomly select

Cure Pikachu
User Off Offline

Quote
@user Mami Tomoe: You forgot the all important # for
player(0,"table")
. What you are doing ATM is getting a random value between 1 and... a table (which will error out). Also, there can be gaps in the player IDs, so whatever this RNG pulls, may not even exist in the server

So if you want to RNG a random player ID that actually exists:
local ptab, pid
ptab = player(0,"table")
pid = ptab[math.random(#ptab)]
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview