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

Need help with universe and matchmaking?

Asked by 7 years ago

So, I'm trying to teleport everyone to one server using roblox's matchmaking scripts, but I always get an error saying that the UserOffline. I don't know what to do and here's what I got.

local arenaPlaceId = game:GetService("AssetService"):CreatePlaceAsync(server.Map.Value..": "..play1, arenaPlaceTemplateId)

    local ownerid = game.Players:FindFirstChild(play1).UserId
    if play2 == nil and play3 == nil and play4 == nil then
    else
        local connection = game.Players:FindFirstChild(play1).OnTeleport:connect(function(teleportState, placeId)
            if teleportState == Enum.TeleportState.Started then
                local teleportStarted = os.time()
                for i=1,3 do
                    local playz = nil
                    if i == 1 then
                        playz = play2
                    elseif i == 2 then
                        playz = play3
                    elseif i == 3 then
                        playz = play4
                    end
                    if playz == nil then
                        break
                    end
                    while true do
                        local success, error, placeId, arenaInstanceId = nil
                        repeat wait() success, error, placeId, arenaInstanceId = teleportService:GetPlayerPlaceInstanceAsync(ownerid) until placeId == arenaPlaceId 
                        if placeId == arenaPlaceId then
                            teleportService:TeleportToPlaceInstance(arenaPlaceId, arenaInstanceId, game.Players:FindFirstChild(playz))
                            return
                        end
                        wait()
                    end 
                end
            end
        end)
    end
    wait(1)

    teleportService:Teleport(arenaPlaceId, game.Players:FindFirstChild(play1))

Everything is defined and this is basically roblox's script, but motified. Can someone tell me the reason this isn't working?

1 answer

Log in to vote
0
Answered by 7 years ago

UserId should be userId, I do believe.

Ad

Answer this question