Help scripting first person gui on specific team

Hello DevForumers, I’m at a roadblock here, I’m trying to make a system so when your on a certain team and you got into first-person, a GUI appears. I’ve gotten the first person section working, I’m just struggling with the team section.

	local function isFirstPerson()
		local camera = workspace.CurrentCamera
		local character = game:GetService("Players").LocalPlayer.Character or  game:GetService("Players").LocalPlayer.CharacterAdded
		if (character.Head.CFrame.p - camera.CFrame.p).magnitude < 1 then
			return true
		else
			return false
		end
	end

	while wait() do
		local isFirstPerson = isFirstPerson()

		if isFirstPerson == true then
			script.Parent.Visible = true
		else
			script.Parent.Visible = false
			script.Parent.Start:Play()	
		end
	end

Thank you - Secretajnz

You can get the player on the client (aka a local script) by using the Players.LocalPlayer property:

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

You can then check which team the player is on with the Player.TeamColor property or the Player.Team property. For your code specifically, I’d recommend adding this check when you check the isFirstPerson boolean:

--top of the code:
local teamColor = BrickColor.new("Really red") -- set to your team's color
-- ...
--boolean check:
if (isFirstPerson == true) and (player.TeamColor == teamColor) then
-- ...