Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

why is this not letting me check the player's team? [SOLVED]

I don't know why I can't do this.

local team = game:GetService("Teams")

local players = game:GetService("Players")

for i,v in pairs(players) do
	
	print(v.team)
end

2 answers

✓ Accepted answer

I think it's because u need to get the players from the players service just like that:

local team = game:GetService("Teams")

local players = game:GetService("Players")

for i,v in pairs(players:GetPlayers()) do

    print(v.team)
end

I think there are some more problems, but I don't know how to solve them or if I'm wrong and there aren't. I hope this fixed the problem.

1 comment

0

Accessing the team property for a Player instance is player.Team, or v.Team in this case.

thanks Bro, your right :)

local team = game:GetService("Teams")
local players = game:GetService("Players")

while true do
	
	wait(.5)
	for i,v in pairs(players:GetPlayers()) do
		
		print(v.team)
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.