GetPlayers (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Itunes89
No edit summary
>JulienDethurens
No edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Deprecated}}
<onlyinclude>{{Method
<onlyinclude>{{Method
|name = GetPlayers  
|name = GetPlayers  
|returns = [[Table]] ''list of players''
|returns = [[table]]
|description = Gives you a table containing all the players in the server.
|description = Returns a table containing all the players in the server.
|object = Players
|object = Players
}}</onlyinclude>
}}</onlyinclude>
Line 9: Line 8:
{{clear floats}}
{{clear floats}}


{{Example|<pre>
==Example==
for _,player in ipairs(game.Players:GetPlayers()) do
 
  player.Character:MoveTo(Vector3.new(0, 50, 0))
This code would move every player to the position {{Vector3|0|50|0}}.
 
{{code|=
for _, player in pairs(game.Players:GetPlayers()) do
if player.Character then
player.Character:MoveTo(Vector3.new(0, 50, 0))
end
end
end
</pre>}}
}}


[[Category:Methods]]
[[Category:Methods]]

Latest revision as of 02:07, 20 March 2012

GetPlayers( )
Returns table
Description: Returns a table containing all the players in the server.
Member of: Players


Example

This code would move every player to the position

0
50
0

.

for _, player in pairs(game.Players:GetPlayers()) do
	if player.Character then
		player.Character:MoveTo(Vector3.new(0, 50, 0))
	end
end