Team checker script

Basically what this script is doing is getting your local player and checks the players team which if is blue prints works.

I have already tried everything and it not that it runs before the player loads in or the theres no end it’s just a piece of the entire code which doesn’t work

for i, player in pairs (game.Players:GetPlayers()) do
if player.Team == “Bright blue Team” then
print(“works”)

2 Likes

If this is at the beginning of a server script, then it is running immediately when the game session is created before the player has likely even finished loading into the game, or potentially before their team is set/changed.

Also, this code is only going to run one time ever unless ran inside a function tied to some event. This means that any players who join after won’t even be checked.

This entire thing is in a loop so when a round ends the whole code runs again

If I’m correct it’s supposed to be if player.TeamColor == Brickcolor.new(“Bright blue”)

Edit: My bad, it’s TeamColor, not Teamcolor, I’m writing this on mobile.

Thanks a lot I was really confused before

No problem, glad I could be of assistance.

An alternative can also be:

if Player.Team == game:GetService("Teams").Team then

That’s if you’re looking to be more precise, though TeamColor works just as well.