-
What do you want to achieve?
So, I have been occupied with a Tower Defense game I have been working on and it’s been going quite well so far. I have gotten everything working to my liking, however one thing I have not tackled before is a lobby/party system to teleport a group of players from the lobby to the place where the main gameplay will take place. However, I am not sure if I am going in the right direction to make this. -
What is the issue?
I am trying to make a lobby/party system so I can teleport players from the lobby to the place to play the actual game, but I am not sure if my brainstormed idea for the system is a good way to go about this. I was looking to see if I can get some feedback on my method I am thinkin about trying
Here is an image of my placeholder UI to show how my lobby system will look. It’s inspired by lysandr’s tower defense game Tower Defenders as I think his game looked great and I liked his system.
-
What solutions have you tried so far?
I have tried searching for a good way to go about this on the dev forum and other areas, but to no avail I was sent back to square one. So, I brainstormed an idea for making the system which is as follows:
When a player presses the join button I will fire a remote event to get the player that joined. I will insert the player into a lobby table tracked on the server and fire a remote to all clients to display that player in the lobby type they joined (solo/duo/trio/quad). Then when the table size reaches the cap set I will prevent anymore players from joining that lobby, initiate a countdown, reserve the server, then teleport the players to the private server when that countdown ends. Then I will empty the table for new players to join. Also if a player in the table presses the join button again I will fire a remote event and remove the player that fired the event from the table. If this happens during the countdown then at the end I will check to see if the lobby is full, if not then no one will teleport.
This is an idea off the top of my head, which I can definitely script without a problem. I would just like to know if there is a better way to do this or if the method I talked about will suffice
You need to split your game into 4 with the amount of players you want in each, and when they are in a duo, it doesn’t start until another player joins, do the same for Trio and Quad
You can use values that detects how many players are there in the waiting, and how many players are needed to start a round. And then if the “Players waiting” value = to “players needed to start a round” then you can make a script that teleports them to the actual game.
*In my opinion that would be more efficient.
Your concept for the lobby place seems solid. You do not need dedicated places for each of the party sizes, however. So long as your “in-game” scripts are written so that they can handle different party sizes by changing a few parameters, you can pass in any information about the party, using the teleportData parameter of the TeleportService’s TeleportToPrivateServer function.
TeleportService:TeleportToPrivateServer (roblox.com)
This would be used in conjuction with TeleportService:GetLocalTeleportationData() which you can just have each player trigger a remote event to server which then makes any necessary adjustments for the party size. (You’ll likely want to ensure that the server only waits for the first triggering of this remote event so it will not apply whatever functions you may include every time a player joins, as each member of the party will arrive at slightly different times).
Thanks for the help from you and @revolucionario2000 . I ended up getting everything to work except for the teleport. For some reason it won’t go through but I will figure that out tomorrow after I have school