misterhup
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 280 |
|
|
| 28 Jul 2015 11:38 PM |
| I want to detect 2 random players and change an Int Value in them (game.Players) that has been added already...How do I find them? |
|
|
| Report Abuse |
|
|
misterhup
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 280 |
|
|
| 28 Jul 2015 11:39 PM |
| Basically every player in my game has an Int Value equals to 1. I want to change it to 2 to just 2 random players. How do I do that? |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2015 11:41 PM |
local P1 = game.Players:GetChildren()[math.random(1,game.Players.NumPlayers)] local P2 = game.Players:GetChildren()[math.random(1,game.Players.NumPlayers)]
P1.IntValue.Value = 2 P2.IntValue.Value = 2
there's the crude way |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 28 Jul 2015 11:42 PM |
^but they can be the same player
robo is love robo is life |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2015 11:44 PM |
That's why I said "crude"
You can also do
local P1 = game.Players:GetChildren()[math.random(1,game.Players.NumPlayers)] local P2 = nil
repeat P2 = game.Players:GetChildren()[math.random(1,game.Players.NumPlayers)] wait() until P2 and P2 ~= P1
P1.IntValue.Value = 2 P2.IntValue.Value = 2
Still crude though |
|
|
| Report Abuse |
|
|
misterhup
|
  |
| Joined: 07 Jul 2010 |
| Total Posts: 280 |
|
| |
|