Basically what the title says. Here is me on solo client test:
As you can see, it works as expected. But when I go team test, I get no errors but for some reason, the gui does not load properly:
Here is my code for each of the scripts. Starting with the server script:
local DataStorePages = PointsDataStore:GetSortedAsync(false, 12, 1, 10e30)
local top = DataStorePages:GetCurrentPage()
while true do
for _, v in ipairs(top) do
local points = v.value
local username = Players:GetNameFromUserIdAsync(v.key)
table.insert(data, {username, points})
end
game.ReplicatedStorage.GlobalLeaderboard:FireAllClients(data)
wait(60)
end
Local script that is in the GUI:
local RS = game:GetService("ReplicatedStorage")
local parent = script.Parent
parent.Parent.ResetOnSpawn = false
local numArray = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve"}
local function setText(array)
for index, str in pairs(numArray) do
if array[index] == nil then
parent:FindFirstChild(str).Text = "No one"
else
parent:FindFirstChild(str).Text = array[index][1]
end
if array[index] == nil then
parent:FindFirstChild("E" .. str).Text = "0"
else
parent:FindFirstChild("E" .. str).Text = array[index][2]
end
end
end
RS.GlobalLeaderboard.OnClientEvent:Connect(setText)