i am trying to make a system where theres 3 squares and when a player walks into it they join it, and it starts a timer, when the timer ends they are teleported to a new server with everyone inside the square, when everyone leaves the square timer stops, kinda like the doors elevator system, i dont know what to call this, so i cant find anything online
look if you want to learn, dont just ask for an entire script system, what I recommend is watch tutorials on youtube on “how to create a queue system” after that then you can incorporate movement into it like an elevator
If you want to make something exactly like that, then you’ll need three main things;
- A box (with invisible walls, ideally with the timer overhead).
- an invisible part next to one of the barrier walls (that way when a player touches it they will be teleported inside)
- A UI that has a “Leave” button (You can make this work via client or server).
I won’t write code for you because I want you to understand this as well as possible, so here’s the step-by-step process of how it would work:
- When the game runs, have a timer that consistently counts down from a given number (for every “box”) and teleports all players inside when it reaches 0 (you can use
Instance:GetPartsInPart()
and get the players from it. You would want to teleport them to a different place (not game)).
Player entering a “box”:
- Player touches the invisible part (2)
- Player gets teleported inside the box
- “Leave” UI button becomes visible for the player that just entered
If they press the Leave button:
- They get teleported out
- UI button becomes invisible
That’s basically all, if I didn’t miss something (please let me know if I did). Hope this helps!
I would make a waiting room(ideally with invisible walls) and make a teleport part. and make a timer overhead, Then if the player touches the teleport part, they get teleported into the box and start the countdown, now you can do one of 2 things. Use GetPartsInPart()
or make a new table for each room. Insert the players User ID inside and when the timer hits 0, teleport them to the game. Both of the methods work equally. so choose one you think is easier.
ok, i understand that part, but how do i make them all go to the same server?
This can be achieved by using the TeleportService:ReserveServer()
function and then teleporting all the players to the reserved server.
If you want a further understanding on how to use the ReserveServer function, then I recommend reading this wiki page: TeleportService | Documentation - Roblox Creator Hub
One last question:
How would I save data for the server? Example:
local data = {
difficulty = "Medium"
map = "Grasslands"
gamemode = "Classic"
}
What exactly do you mean by “save data”? Do you mean getting data for later?
yeah, like saying that server will be using the variables i set
how would i send those variables to that server and let that server read them once players join, i set “difficulty” and the value of that will be sent to the server, and the server will read it and it can run scripts based off it (like more difficulty = more enemies)
You could use TeleportService:GetLocalPlayerTeleportData()
and send information to the server via a RemoteEvent, but I would only use this as a last resort personally because exploiters can tamper with important data on the client.
There are probably other methods that could be used to transfer data to the server in a safer manner but I wouldn’t bother with them because they are most likely a bit more unconventional and I am unaware of how else to achieve it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.