English Number randomly select

5 replies
Goto Page
To the start Previous 1 Next To the start
09.05.19 07:36:15 pm
Up
phalenkO
User
Offline Off
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.
Code:
1
math.random(1,32)
I founde the that but how to I using, idk.
09.05.19 09:05:50 pm
Up
Mami Tomoe
User
Offline Off
id = math.random(1, player(0, 'table'))
10.05.19 01:17:00 pm
Up
Cure Pikachu
User
Online On
@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:
Code:
local ptab, pid
ptab = player(0,"table")
pid = ptab[math.random(#ptab)]
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
10.05.19 02:14:28 pm
Up
Mami Tomoe
User
Offline Off
Oh yeah,

Code:
1
id = player(0, 'table')[math.random(#player(0, 'table'))]


was what I meant.
10.05.19 04:49:27 pm
Up
phalenkO
User
Offline Off
@user Mami Tomoe: @user Cure Pikachu: This code, you did define the all player ID? I dont understand the that code:(
10.05.19 05:00:07 pm
Up
Mami Tomoe
User
Offline Off
It returns a random player on the server.
Change
'table'
to
'tableliving'
if you only want living players.
To the start Previous 1 Next To the start