Hey Developers!
I’ve been recently trying to develop a hub to get to all my football team fields, however, I want to make it that you can see the player count on each billboard UI.
. No, I’m not asking to be spoon-fed. I already have something that I think should work.
function playerCount()
local success, servers = pcall(function()
return playerCountStore:GetSortedAsync(true,100)
end)
local places = servers:GetCurrentPage()
for i, place in pairs(places) do
local id = place.key
local count = place.value
if game.ReplicatedStorage.PlayerCount:FindFirstChild(id) ~= nil then
game.ReplicatedStorage.PlayerCount:FindFirstChild(id).Value = count
else
local val = Instance.new("IntValue",game.ReplicatedStorage.PlayerCount)
val.Name = id
val.Value = math.max(0,count)
end
end
return success
end
game.ReplicatedStorage.Events.PlayerCount.OnServerInvoke = playerCount
And this in another script:
while true do
wait(1)
for _,v in pairs(Pages.Stadiums.List:GetChildren()) do
if v:IsA("Frame") then
game.ReplicatedStorage.Events.PlayerCount:InvokeServer()
if game.ReplicatedStorage.PlayerCount:FindFirstChild(v.PlaceID.Value) ~= nil then
v.Online.Text = game.ReplicatedStorage.PlayerCount:FindFirstChild(v.PlaceID.Value).Value.." Players Online"
end
end
end
end
However, when the script runs in the game, it keeps saying, “two many request, try running fewer requests”
Now, I don’t know how to fix this, or ‘send fewer requests’.
I started to research and I saw this post talking about it, but nobody solved anything.
Please help.