I am trying to make a feature in my game where players can see how many players are on the team that they are trying to join. I am using a gui and it has a button that puts me onto the team along with a textbox that should show how many players are on the team. When I run the script it just shows 0/5 even when I join the team, and I don't get any errors. I made a number value inside the team itself and I have a function that should increase or decrease the value of it when a player is added to that team. Here's what I have in the script that is inside of the textbox
local t1 = game.Teams.T1
local tPlayers = t1.Players.Value
script.Parent.Text = tPlayers.. "/5"
t1.PlayerAdded:connect(function()
tPlayers = tPlayers + 1
end)
t1.PlayerRemoved:connect(function()
tPlayers = tPlayers - 1
end)
I hope this is enough info. If there is also a way to make the amount of players into a table then I can figure out how to get that to work as well. Thank you!

2 comments
Try changing the tPlayers inside the events to tPlayers.Value = tPlayers.Value - 1; and the local tPlayers to t1.Players.
YES!!! thank you so much it works