datdude3
|
  |
| Joined: 23 Apr 2010 |
| Total Posts: 577 |
|
|
| 05 Mar 2012 05:12 PM |
| So what would the script be if I had 5 games and I wanted roblox to choose them randomly? |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2012 05:15 PM |
If you mean maps then you would use do
--Psuedo code maps = getAllMaps() math.randomseed(tick()) newMap = maps[randomNumber] Clone newMap into workspace |
|
|
| Report Abuse |
|
|
datdude3
|
  |
| Joined: 23 Apr 2010 |
| Total Posts: 577 |
|
|
| 05 Mar 2012 05:16 PM |
| That is useful but I'm talking about changing player everytime for the game |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2012 05:19 PM |
| Still am not understanding you . . . |
|
|
| Report Abuse |
|
|
datdude3
|
  |
| Joined: 23 Apr 2010 |
| Total Posts: 577 |
|
|
| 05 Mar 2012 05:22 PM |
| Ok so lets say this one guy named bob was in my game and was playing how would I make a different player the role of what bob had? |
|
|
| Report Abuse |
|
|
Rangerko
|
  |
| Joined: 12 Sep 2008 |
| Total Posts: 126 |
|
| |
|
datdude3
|
  |
| Joined: 23 Apr 2010 |
| Total Posts: 577 |
|
|
| 05 Mar 2012 05:32 PM |
| Its like tag it selects random players to be the enemy or something |
|
|
| Report Abuse |
|
|
|
| 05 Mar 2012 05:47 PM |
All right, I'll show you how to find a random player, but you take care of what to do with it.
local rplr = game.Players:GetPlayers()[math.random(#game.Players:GetPlayers())]
Now the variable `rplr` is a random player in the server.
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2012 03:40 PM |
| Make sure that is declared inside the function, or else it will only get a random player once instead of finding a new one every time the function is called. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2012 04:02 PM |
@epicfail - What function? I didn't declare any. :/
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2012 04:03 PM |
Excluding math.random, that is.
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss-
|
|
|
| Report Abuse |
|
|
top1
|
  |
| Joined: 05 Mar 2009 |
| Total Posts: 115 |
|
|
| 06 Mar 2012 04:09 PM |
| The creator probably wants more random people and then he would make a function fduh.. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2012 04:21 PM |
@Top - I know. I was kidding, epicfail said 'the function', but there was none. Anyways, I did say he could take it from what I gave him, in case you didn't read that. Though I suppose I'll post a function for that, too...
function RPlayers() return game.Players:GetPlayers()[math.random(#game.Players:GetPlayers())] end
Now the function `RPlayers` will return a random player. So, here's an example of its use:
local rp1 = RPlayers() local rp2 = RPlayers()
Now rp1 and rp2 are two random players. They might be the same though. You take care of that.
You now have +10 INT from this post. Oh, by the way, Like an __AWESOME__ boss- |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2012 04:37 PM |
| @ElectricBlaze; I was referring to when the OP uses it. Not what you posted. |
|
|
| Report Abuse |
|
|