GetTeams (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>ArceusInator
better example (imo)
>Blocco
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 9: Line 9:




{{Example|This is an example of using the method above to get all the teams and remove them. Includes the generic for loop.
{{Example|<pre>
<pre>
local teams = Game:GetService("Teams"):GetTeams()
local teams = Game:GetService("Teams"):GetTeams()


if type( teams ) == "table" then
if #teams > 0 then
   print( "There are " .. #teams .. " teams." )
   print( "There are " .. #teams .. " teams." )
   print( "They are as follows:" )
   print( "They are as follows:" )

Latest revision as of 22:28, 13 January 2011

GetTeams( )
Returns Table teams
Description: Returns a table of all of the teams.
Member of: Teams


Example
local teams = Game:GetService("Teams"):GetTeams()

if #teams > 0 then
   print( "There are " .. #teams .. " teams." )
   print( "They are as follows:" )
   for i = 1, #teams do
      print( "Team " .. i .. ": " .. teams[i].Name )
   end
else
   print( "There are no teams!" )
end