|
| 10 Jul 2015 05:54 PM |
Okay I need a choosing random player math random thingy mobbob
heres what I've got:
players = game.Players:GetChildren() local ranPlayer = players[math.random(1, #players)]
okay for my problem it says i am indexing a nil value.
Someone told me this is what is happening
local ranPlayer = players[math.random(1, 0)]
How do I make a script that if there is one player loading in it waits for like 15 seconds but if there is more than 1 player it will skip the wait for 3 seconds. my code still stuffs up with the wait so I am doing something wrong. |
|
|
| Report Abuse |
|
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 10 Jul 2015 05:56 PM |
or you could do repeat wait() until game.Players.NumPlayers > 1 |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2015 05:56 PM |
ranPlayer[math.random(1, #players)]
Growing old is mandatory - growing up is optional. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2015 06:02 PM |
| nope still comes up with trying to index a nil value. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2015 06:04 PM |
Go on Youtube and search up ROBLOX University. I think I recall when Stickmasterluke did a tutorial of this on the Mad Bloxxer. Not sure.
Growing old is mandatory - growing up is optional. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 10 Jul 2015 06:07 PM |
| Just wait until there are 2 players in the game. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2015 06:13 PM |
local table = require(199207348)
local ranPlayer = table.random(game.Players:GetPlayers()) |
|
|
| Report Abuse |
|
|