This script worked fine some months ago, but when I implemented it to my new game, I found out that it doesn't work anymore:

local DataStore = game:GetService("DataStoreService"):GetDataStore("ServerList")
key = "Server-Master01"
local newdata

local connection = DataStore:OnUpdate(key, function(value)
    local mydata = DataStore:GetAsync(key)
local   serveralreadyexists = false

    for i,v in pairs(game.ReplicatedStorage.Servers.Folder:GetChildren()) do
        for z,x in pairs(mydata) do
            if v.ServerId == x then
                serveralreadyexists = true
            end
        end
    end

    if serveralreadyexists == true then
        for i,v in pairs(game.ReplicatedStorage.Servers.Servers:GetChildren()) do
            if v == value then
                v.Players.Value = value.Players.."/".."20"
            end
        end
    else

        for i,v in pairs(value) do -- Line where the error appears
            local temp = script.Parent.ServerId:Clone()
            local template = temp
            template.Value = value[i].ServerId
            template.Players.Value = value[i].Players.."/".."20"
            template.Parent = script.Parent.Parent.ReplicatedStorage.Servers.Servers
        end

    end
end)

I've got "Bad argument #1 to pairs (target excepted, got nil)" because the "function(value)" isn't working anymore. I need help fixing this so I can continue finishing the server list in my game, thanks for helping!

1 comment

0

is this a free model?