How do I make a Hunger Games style player count GUI from the amount of players inside a Team

So I’m trying to make a hunger games-style player count that checks for the number of players in a team and changes a number on a GUI. So if a player joins the team or leaves the game/leaves the team, the number goes up or down instantaneously.

I’ve tried a few different scripts and this is the final one I was able to come up with, with my limited scripting knowledge, I’m very lost on how I’d change the text’s value inside a TextButton.

I’ve looked through some of the developer forums for similar questions but I’m finding solutions to round-based game player counts when I’m trying to make a player count for players inside a team.

local Players = game:GetService('Players')
local Teams = game:GetService('Teams')
local PlayerCount = game.StarterGUI.PlayerCount.Number

		if plr.Team == Teams.Player then
			PlayerCount.Text = +1

You can get the number of players on a team using #TeamObject:GetPlayers().

You can format it for text by converting it into string tostring(#TeamObject:GetPlayers())

Replace TeamObject with the team object.

1 Like

#Team:GetPlayers() does not work for me, I get an error telling me that I can’t measure the length of an Instance. Would you kindly assist me in this matter?