I’m trying to make a list that shows how many players are online on all servers.
My problem is that it only picks one server to count, so I made a for loop that loops through all server player count. But now it picks the one with the lowest players.
I’m new to all of this stuff so I’m having a hard time trying to solve this, A solution would be very appreciated.
for i,v in pairs(data) do
wait(0.1)
local alldata = data[0 + i]["playing"]
script.Parent.Text = tostring(alldata) .. " Players Online"
end
local total = 0 --starting from 0
for i, server in pairs(data) do
task.wait(0.1)
--data[i] is equal to the current value(server)
--value1 += value2 is value1 = value1+value2
total += server["playing"]
end
--tostring isn't needed
script.Parent.Text = total.." Players Online"