You can write your topic however you want, but you need to answer these questions:
-
I wanna make my game have a lobby system that teleports you from a level to another and can include more players in it, however, the knowledge i detain just doesn’t cut it and i run into errors.
-
My problem is that i can’t teleport players from a lobby to a place
The script is as following
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local TeleportService = game:GetService(“TeleportService”)
local teleportOptions = Instance.new(“TeleportOptions”)
local PlayersToTeleport = {}
ReplicatedStorage.Teleport.OnServerEvent:Connect(function(blablabla, LobbyNr, SelectedLv)
for i, v in pairs(ReplicatedStorage.OccupiedLoobies["lobby"..LobbyNr]:getChildren()) do
if v:IsA("StringValue") and v.Value ~= nil and i <= ReplicatedStorage.OccupiedLoobies["lobby"..LobbyNr]["nrOfPlayer"..LobbyNr].Value then
local Sufix = "p"..i
PlayersToTeleport[Sufix] = game.Players:FindFirstChild(v.Value).Name
print(game.Players:FindFirstChild(v.Value).Name)
end
end
wait(60)
--local reservedServerAccessCode = TeleportService:ReserveServer(SelectedLv)
teleportOptions.ShouldReserveServer = true;
--TeleportService:TeleportToPrivateServer(SelectedLv, reservedServerAccessCode, game.Players:GetChildren(PlayersToTeleport))
TeleportService:TeleportAsync(SelectedLv, game.Players:GetChildren(PlayersToTeleport), teleportOptions)
end)
- nothing seems to work as far as i took it