|
| 20 Feb 2014 05:21 PM |
game.Players.ChildAdded:connect(function() wait(20) for numbers,players in pairs(game.Players:GetPlayers()) do player.Character:MoveTo(Vector3.new(3427.542, 93.096, 574.333)) end end)
This Moves all the players, I want it to move one of them to the certain position can someone help? |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2014 05:22 PM |
game.Players.ChildAdded:connect(function() wait(20) for numbers,players in pairs(game.Players:GetPlayers()) do if player == "something" then --I'll let you finish it off player.Character:MoveTo(Vector3.new(3427.542, 93.096, 574.333)) end end end) |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2014 05:23 PM |
| yeah insert a bool value in the player or something and randomly pick one true |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2014 05:23 PM |
| No, I want it to choose a random player out of all the players. |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2014 05:25 PM |
players = game.Players.getPlayers() players[math.random(1, #players) |
|
|
| Report Abuse |
|
|
7y13rb
|
  |
| Joined: 28 May 2011 |
| Total Posts: 223 |
|
|
| 20 Feb 2014 05:26 PM |
to randomly pick a player just do:
local p = game.Players:Children() --gets all players local player = p[math.random(1,#p)] --picks a random one and names it "player" in script
so basically you could do local p = game.Players:Children() local player = p[math.random(1,#p)] if player ~= nil then --if they still exist then print 'player exists' elseif player == nil then print 'player doesn't exist' end |
|
|
| Report Abuse |
|
|
|
| 20 Feb 2014 05:27 PM |
Although this might give some unwanted results since you want this to fire when the a player enters the server
game.Players.ChildAdded:connect(function() wait(20) for numbers,players in pairs(game.Players:GetPlayers()) do local random = players[math.random(1,#players)] random.Character:MoveTo(Vector3.new(3427.542, 93.096, 574.333)) end end end) |
|
|
| Report Abuse |
|
|