I made a lobby which teleports players in the queue to the actual game(max: 4) in the destination the playrs are being teleported to how do i make the script wait for the players before starting?
You can use a repeat loop for this. I am assuming you are storing the players you want to teleport in an array/list (it would be helpful if you included your code) so you can use the #
operator to get the amount of values in your array (the number of players in the queue in this case).
repeat
task.wait() -- a wait to avoid a crash, I recommend looking up repeat loops as they are extremely basic.
until #yourArrayOfPlayers >= minimumAmountOfPlayersHere
-- teleport here
But how would the playerTable data get passed to the destination place?
you can use
for num, player in pairs(game.Players:GetChildren())
if num > 4 then
-- teleport script
-- you can use player.Character.HumanoidRootPart to teleport people
end
end
Note: this script that i gave is 1 time only. if you want it for a loop then add while do
Ok i think everyones confused, im teleporting the players from a StartPlace to a ReservedServer
you can still use the “player” variable from the code i gave. the for do
will teleport each players 1 by 1 to the reserved server
You can use the new MemoryStoreService to accomplish this, an article on it as well as documentation can be found here: Memory Stores | Roblox Creator Documentation
Note; I removed the first part of my post as there could be multiple issues with implementing it properly. Teleport data can be sent by the client as well as the server and this could have some unexpected consequences that I have overlooked.
I dont think you get it because thats not what im asking
This is a good solution but Since i was using TeleportService
i might aswell use TeleportData
and GetLocalPlayerTeleportData()