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.
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)