#help with reserved servers

1 messages · Page 1 of 1 (latest)

thorn lynx
#

Been trying to teleport players to a reserved server but it just says "Attempted to teleport to a place that is restricted.", I have no clue what im doing wrong here (This is only when attempting to join an already made server, creating one has no issues).

code for creating servers

local TeleportService = game:GetService("TeleportService")

local memoryStoreService = game:GetService("MemoryStoreService")
local infostore = memoryStoreService:GetQueue("ServerAccessIDs")

script.Parent.createserver.OnServerEvent:Connect(function(plr)
    local code, privateid = TeleportService:ReserveServer(game.PlaceId)

    TeleportService:TeleportToPrivateServer(game.PlaceId, code, {plr})

    local info = {
        [privateid] = code
    }

    infostore:AddAsync(info, 259200, 0) -- save it so other people can access the code
end)
#

one sec im trying to post the rest of the code but for some reason discord keeps blocking it

#
local memoryStoreService = game:GetService("MemoryStoreService")
local infostore = memoryStoreService:GetQueue("ServerAccessIDs")

local function readQueueData(whatToCheckFor)
    local success, queueItems = pcall(function() -- wrap in pcall to prevent app from crashing
        return infostore:ReadAsync(100, false, 0)
    end)
    
    local found = false
    
    if success and typeof(queueItems) == "table" then-- check if request succeeded and if the data is a table
        for i, data in ipairs(queueItems) do
            warn("READING QUEUE", i, data)
            for b, data2 in pairs(data) do
                warn("READING QUEUE TABLE", b, data2)
                if b == whatToCheckFor then
                    found = true
                    return b, data2
                end
            end
            if found then break end
        end
    elseif typeof(queueItems) == "string" then -- check if the queue items is a string. If it is, it'll indicate that it is an error.
        warn("failed to fetch queue data for reason of: %s", queueItems)        
    end
end

script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr, serverid, privateid, reserved)
    print(serverid, privateid, reserved)
    if reserved then
        print("yes reserved")
        
        warn("-----------------------")
        local id, accesscode = readQueueData(privateid)    
        warn("-----------------------")
        warn(id, accesscode)
        
        if accesscode then
            print("access code exists")
            --opts.ReservedServerAccessCode = accesscode
            game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceId, accesscode, {plr})
        end
        
    else
        print("normal server, use jobid")
        --opts.ServerInstanceId = serverid
        local opts = Instance.new("TeleportOptions")
        opts.ServerInstanceId = serverid
        game:GetService("TeleportService"):TeleportAsync(game.PlaceId, {plr}, opts)
    end
end)
#

this is for trying to join servers ^

jagged epoch
#

or private

thorn lynx
#

its the same place as where you create servers from

#

you wouldnt be able to make a server in the first place if it was

jagged epoch
#

right, interesting

thorn lynx
#

ok wait i might've just figured out why

jagged epoch
#

what did you try?

thorn lynx
#

it was the method i was using to have 2 instances of roblox open

#

that somehow fucked with it

jagged epoch
#

oh

thorn lynx
#

debugging for 2 hours for nothing 😭

jagged epoch
#

i can try for u

#

if u want

thorn lynx
#

i got someone to

#

its all good

jagged epoch
#

kk

flat patio
#

publish the other place

#

@thorn lynx

thorn lynx
#

already solved