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

Checking if a player is in a certain team [???]

Hello, I'm trying to check if a player is in a certain team. Here is my script:

game.Players.PlayerAdded:Connect(function(player)
	if player.Team == game.Teams.Supervisor then
		print("yes")
	end
end)

It's not printing yes. The script is located in ServerScriptService.

3 answers

Hello, try using player.TeamColor incase Team might not work.

1 comment

0

that did not work.. oof

Try to use player.TeamColor.

game.Players.PlayerAdded:Connect(function(player)
    if player.TeamColor == BrickColor.new("Really red") then --Make sure you get the right brickcolor.
        print("yes")
    end
end)

1 comment

0

He said it didn't work.

Hello! Since you said the above 2 problems didn't work, I'd start by printing the player's team to make sure it's exactly the correct one (well, it should show that on the leaderboard but it's not always correct, check what I'm saying below)

print("Player's team: " .. plr.Team)

I'd also make sure the player's TeamColor is exactly the same as the Supervisor's, and that's done by going to the explorer (while you're in-game), then to the players tab and click on your player's name, scroll down and check for TeamColor and Team.

Now I want to know how you set the player's team exactly, you might be doing it wrong.

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