How to check a Player's team if they aren't on a team

I am making different gamemodes for a game I am making, and I want to know how I would check if a Player isn’t on any team, if no teams exist.
image
^ This is what I mean, if you don’t understand. How would I check this in a script?

use Player.Team (Player.Team is an instance)

local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local Player = Players.LocalPlayer

local Team = Player.Team

if Teams == Teams["Bad guys"] then
-- stuff
end

So if I would like to check that, would I call the team nil?

You can print the players team by using this code

local Teams = game:GetService("Teams")
local Player = Players.LocalPlayer

local Team = Player.Team

if Teams = Teams["Bad guys"] then
print("Player is in a team") 
--put your code here
else
print("Player is not in a team") 
--put your code here
end

Hope this helps!

If you want to check if the player is not in any team the just do

if Player.Team = nil then
-- only runs if the player is not in a team
end
1 Like

Since there isn’t a team name, use the TeamColor, they can both be used…

Can’t you just check to see if the player.Team they are on is equals to nothing (nil). If you wanted to see if there are any teams at all you could also check if there are any teams in the team service.

if not Player.Team then
Player.Team will be evaluated as true or false, ‘not’ will flip the result.