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

How to find which team player is in?

I have 2 teams - Blue, and Green team

how do I check which team player is in?

so when I join the game I randomly get put in the blue team, and a GUI will pop that only Blue team members can see.

local player = game:GetService("Players").LocalPlayer

function teamcheck()
 script.Parent.Frame.Visible = true
end

-- if the player is in the blue team then 
-- teamcheck()

Teams - Bright blue Team ; Bright green Team

3 comments

0

You should research your issue before coming to SH: if (Player.Team == Team) then

0

@Feahren it didnt work

0

If the team is changed to Bright blue Team, the code has already executed by then.

2 answers

You could try this code; ultimately you could use "Team Color" or "Player.Team"

local player = game:GetService("Players").LocalPlayer

function teamcheck()
 script.Parent.Frame.Visible = true
end

if player.TeamColour == "Bright blue" -- name of your TeamColor 
then
    teamcheck()
end

4 comments

1

If this didn't work, try debugging it, or try searching it up!

0

didnt work

1

Try debugging it

0

but I fixed it

local player = game:GetService("Players").LocalPlayer

function teamcheck()
 script.Parent.Frame.Visible = true
end

if player.Team == "Bright blue Team" then
	teamcheck()
end

2 comments

0

didnt work

0

It is because it is case sensitive; make sure to change the name of the team to the EXACT same name for the team.

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