Hello! I’m trying to show the number of players in my teams in my textLabel.Text, what am I doing wrong? They are not showing
localscript on StarterPlayerScripts:
local Teams = game:GetService("Teams")
-- Reference the player's PlayerGui
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local TPS_GUI = playerGui:WaitForChild("TPS WITH MICHROMA")
-- Reference the TextLabels inside the ImageLabels
local blueTeamLabel = TPS_GUI.Frame.Countdown.blueCounter:WaitForChild("textLabel")
local redTeamLabel = TPS_GUI.Frame.Countdown.redCounter:WaitForChild("textLabel")
-- Wait for teams to be created
local blueTeam = Teams:FindFirstChild("Blue Team")
local redTeam = Teams:FindFirstChild("Red Team")
if blueTeam and redTeam then
-- Extract the first character of the player count for each team
local blueChar = tostring(#blueTeam:GetPlayers()):sub(1, 1)
local redChar = tostring(#redTeam:GetPlayers()):sub(1, 1)
print(blueChar)
print(redChar)
local blueValue = blueChar
local redValue = redChar
-- Update the TextLabels with the first character
blueTeamLabel.Text = blueValue
redTeamLabel.Text = redValue
print("Team 1 Players: " .. #blueTeam:GetPlayers())
print("Team 2 Players: " .. #redTeam:GetPlayers())
else
warn("One or both teams not found.")
end