Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Datastore works in studio, not online though, no reason why it shouldn't work though?

Asked by 6 years ago
local dataStoreService = game:GetService('DataStoreService')
local orderedData = dataStoreService:GetOrderedDataStore('OrderedData')

local replicatedStorage = game:GetService('ReplicatedStorage')
local eventFolder = replicatedStorage:WaitForChild('EventFolder')
local updateBoard = eventFolder:WaitForChild('UpdateBoard')

while true do
    local pages = orderedData:GetSortedAsync(false, 100)
    local data = pages:GetCurrentPage()
    for _, player in pairs(game.Players:GetPlayers()) do -- Stopping here
        if player then
            print('Fire')
            updateBoard:FireClient(player, data)
            print('Fired')
        end
    end
    wait(300)
end

When I test in studio, it works perfectly, prints the stuff, etc.

But online, it doesn't. No errors. It doesn't print any lines. It stops where I have indicated, but I don't know why it's stopping at that spot, because it shouldn't

0
The code will probably run before there are any players in the game. I would also recommend that you use FireAllClients and that you store this data on the server where players can ask for it when they join the game. User#5423 17 — 6y

Answer this question