generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Certain player Position

Previous Thread :: Next Thread 
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
20 Feb 2014 05:23 PM
yeah insert a bool value in the player or something and randomly pick one true
Report Abuse
LilMcManiac is not online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
20 Feb 2014 05:23 PM
No, I want it to choose a random player out of all the players.
Report Abuse
Drybones3363 is not online. Drybones3363
Joined: 16 Aug 2013
Total Posts: 1547
20 Feb 2014 05:25 PM
players = game.Players.getPlayers()
players[math.random(1, #players)
Report Abuse
7y13rb is not online. 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
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image