How can i get the total amount of points a team has? And shown at GUI

Hello!

I have 2 teams in my game and i want to make a GUI that will show the total amount of points team has.
But i don’t know how to get the sum of point of the all team members.

I made a template how it will look like i just need to know how to get a sum of points

Thanks for help!

Screenshot_112

Will the points be the amount of kills?

1 Like

Yes, player get 1 point per 1 kill and i want to get total points of all team members in this gui

1 Like

Add a NumberValue into each player on each team, and everytime they get a kill you add 1 into that Value. Then, you could run a for i,v in pairs loop and add all the values together and display it as the text.

1 Like

Team Instances have a GetPlayers method which returns an array of Players in that Team.
You can simply iterate through that array and add up the sum.

Here’s a short example:

local Teams = game:GetService('Teams');
local Sum = 0;

for _, Player in ipairs(Teams.Red:GetPlayers()) do
    Sum = Sum + Player.Kills.Value;
end
9 Likes