How do I make this screenGUI only appear above teammate's heads?

I want to make this screenGUI appear to one team and not to the enemy team. I also want it to do the same on the enemy team’s end.

I tried looking for other topics related to mine but they only either show above everyone’s heads or above everyone in a specific group on roblox.

Screenshot_20230129_081703

I’m not asking you to write an entire script but more of what I should be looking for to solve my problem.

Find a way to get the Players’ team.
If you’re using Teams (service) then just loop through all of the players and check what their team is using “Player.Team”.

Compare if their team is either red team or blue team using an if statement.
if Player.Team == "Red Team" then

If their team is Red Team then clone the frame using “:Clone()” and add it to their character or set it’s Adornee accordingly.

Do the same for the other team.
Here’s some more information about Teams that may help you.

Looping: Intro to For Loops | Roblox Creator Documentation
Cloning: Instance | Roblox Creator Documentation

1 Like

I think the main thing here is that you use a LocalScript. In the LocalScript, enable your team’s billboardguis.

Since you’re doing this from a LocalScript, the enable property will not replicate to other players.

Baseplate.rbxl (42.1 KB)
Proof of concept that I made.

Would I set the Adornee to the name of the team? Also, this is what I tried so far.

local Players = game:GetService("Players")
local Teams = game:GetService("Teams")

local TeammateShower = workspace.screenGui
local copy = TeammateShower:Clone()

if Players.Team == "Resistance" then
	local copy = TeammateShower:Clone()

	copy.Parent = TeammateShower.Parent

	copy:SetPrimaryPartCFrame(CFrame.new(0, 50, 0))
end

You’re going to want to loop through players to find the certain player.

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

for _, Player in pairs(Players:GetPlayers()) do
	if Player.Name == localPlayer.Name then return end -- Make sure to only add the indicator to other players

	local Character = Player.Character or Player.CharacterAdded:Wait()
	local Copy = workspace.Indicator:Clone()
	Copy.Enabled = true

	Copy.Parent = Character:WaitForChild("Head")
	Copy.Adornee = Character:WaitForChild("Head")

	if Player.Team.Name == "Resistance" then
		Copy.Frame.BackgroundColor3 = Color3.fromRGB(255, 84, 78) -- Red

	elseif Player.Team.Name == "Other Team Name"  then
		Copy.Frame.BackgroundColor3 = Color3.fromRGB(56, 116, 255) -- Blue
	end
end

Make sure this is a LocalScript on the client, and feel free to take a copy:
TeamIndicator.rbxl (45.1 KB)

I recommend that you check up on the following:
Looping: Intro to For Loops | Roblox Creator Documentation

The Creator Documentation page is honestly a great place for help on learning new things!