GetPlayers (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens
No edit summary
>Legend26
It's not guaranteed that the character exists.
Line 10: Line 10:
{{Example|<code lua>
{{Example|<code lua>
for _, player in pairs(game.Players:GetPlayers()) do
for _, player in pairs(game.Players:GetPlayers()) do
player.Character:MoveTo(Vector3.new(0, 50, 0))
if player.Character then
player.Character:MoveTo(Vector3.new(0, 50, 0))
end
end
end
</code>}}
</code>}}


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

Revision as of 01:17, 20 March 2012

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


Example

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