BotBit
|
  |
| Joined: 05 Jan 2015 |
| Total Posts: 163 |
|
|
| 10 Jan 2015 08:48 AM |
plrs = game.Players:GetPlayers()
for _, plr in pairs(plrs) do randomPlr = math.random(1,#plrs) chosenPlr = plrs [randomPlr] print(chosenPlr.Name) end
Am I doing this right so far? I am making a script to pick a random player then teleport him somewhere, could someone assist me with this please, I am stuck. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2015 08:49 AM |
Test it...
Lrn 2 cod lua m8 |
|
|
| Report Abuse |
|
|
BotBit
|
  |
| Joined: 05 Jan 2015 |
| Total Posts: 163 |
|
|
| 10 Jan 2015 08:51 AM |
| It works, I just need someone to guide me through how to make this, I am trying to learn scriptin m8. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2015 08:52 AM |
So someone wrote it for you...
Lrn 2 cod lua m8 |
|
|
| Report Abuse |
|
|
BotBit
|
  |
| Joined: 05 Jan 2015 |
| Total Posts: 163 |
|
|
| 10 Jan 2015 08:54 AM |
| No, I had someone teaching me this last night, no one just wrote it for me, they helped me write it. I need someone to guide me through the rest. |
|
|
| Report Abuse |
|
|
|
| 10 Jan 2015 08:56 AM |
Why not learn to code the rest, not many people would teach you for free.
Lrn 2 cod lua m8 |
|
|
| Report Abuse |
|
|
BotBit
|
  |
| Joined: 05 Jan 2015 |
| Total Posts: 163 |
|
|
| 10 Jan 2015 08:58 AM |
| I am not asking to be taught for free, I will pay, but I was more asking for someone to lead me through places to find where to do this, I don't know where to look on the wiki. |
|
|
| Report Abuse |
|
|
BotBit
|
  |
| Joined: 05 Jan 2015 |
| Total Posts: 163 |
|
| |
|
|
| 10 Jan 2015 09:54 AM |
I won't "teach" you because I do not dedicate my time like that, but I will help you find what you need or help explain something if you PM me.
--Set the varaible "plrs" to be a list of the current players in the server. --http://wiki.roblox.com/index.php?title=API:Class/Players/GetPlayers plrs = game.Players:GetPlayers()
--Get a random number between 1 and the number of players in the list. --http://wiki.roblox.com/index.php?title=Function_dump/Mathematical_functions#math.random randomPlr = math.random(1,#plrs)
--Get the player from the list based on the random number above. --If the number was 2, then it would get the second player on our list. --The list doesn't match the PlayerList in the game. chosenPlr = plrs [randomPlr]
--Print the chosen player's name to the console. print(chosenPlr.Name) |
|
|
| Report Abuse |
|
|