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

Help with ServerScriptStorage?

Asked by 10 years ago

Script is located in ServerScriptStorage

local ods = game:GetService("DataStoreService"):GetOrderedDataStore("Scores")
function updateBoard(board, data)
    for k,v in pairs(data) do
        local pos = k
        local name = v.key
        local score = v.value
        local dispname = board:findFirstChild("Name"..pos)
        local dispval = board:findFirstChild("Score"..pos)
        dispname.Text = tostring(name)
        dispval.Text = tostring(score)
    end 
end

while true do
    wait(10)
    local pages = ods:GetSortedAsync(false, 10)
    local data = pages:GetCurrentPage()
    updateBoard(game.Workspace.HighScore.TopBlock.SurfaceGui, data) -- change 'game.Workspace.HighScore.TopBlock.SurfaceGui' to where it will be
end

Error in Output ServerScriptService.Script:16: attempt to index local 'ods' (a nil value) I don't know why this dosent work? It is froms Dummiez Leaderboard, and I placed all the scripts in the right spots, but this has an error. Please help

0
It might be because the datastore "Scores" doesn't exist yet on the player/server, and so it's trying to get "Scores" when it doesn't exist. This can be completely wrong, since I rarely use saving. Another note is that the problem has nothing to do with ServerScriptStorage; ServerScriptStorage is just another place to put scripts in so they can run. hievery1 70 — 10y
0
so how could I fix the problem, just have a wait(10) before script? NinjoOnline 1146 — 10y

Answer this question