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

Issues with Global Datastore?

Asked by
orcazate 170
4 years ago

I have some errors regarding a global datastore not functioning correctly. I will attach the code I am using to call said value and to set it. HTTP and Roblox Studio API are all good.

Setting code:

local CreatedServer = TeleportService:ReserveServer(game.PlaceId)
local Dict = {
        ServerName = group,
        PlayerName = plr.Name,
        RoleName = RoleName,
        GroupID = groupID,
    }

    serverData[CreatedServer] = Dict

Original setup:

local DataStoreService = game:GetService("DataStoreService")
local HttpService = game:GetService("HttpService")

local serverDataStore = DataStoreService:GetDataStore("jreiogehrughwrjghew3kjghe")

local serverData = {} 
local success, getServerData = pcall(function()
    return serverDataStore:GetAsync("Main")
end)

if success then
    serverData = getServerData
end

local function VerifyServers()
    for code,data in pairs(serverData) do
        --
    end
end

print(serverData)
if serverData then
    for i,v in pairs(serverData) do
        print(i, v["ServerName"])
    end
end


It calls nill. I have it screenshot. It’s kinda hard to read.

photo

Answer this question