I already have a death counter script for individual people. I was wondering how I would be able to combine everyones deaths and show the total amount of deaths on a sign. I already have a Part > SurfaceGui > TextLabel.
✓ ANSWER ACCEPTED
How would I make a sign show total amount of deaths taken?
2 answers
✓ Accepted answer
Use a Server Script. I think events are best to use because it only runs when the event is happening compared to while loops which are always running.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterRemoving:Connect(function() --Whenever a character is removed, in other words, dies
script.Parent.Text = tonumber(script.Parent.Text)+1
end)
end)
So what you would do first off, is getting all the players running a function for each of them, in this case you would be getting the value of their deaths, and adding them together, it might look something like this
while wait(1) do
local deaths = 0
for i,v in pairs(game.Players:GetPlayers()) do
deaths = deaths + v.leaderstats.Deaths.Value
end
script.Parent.Text = deaths
end
You would put this script in the text label
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
can you tell us where this individual value is in the player?
It creates a new Folder called "leaderstats" and in that is called "Deaths"