As a Roblox developer, it is currently too hard to use just one place for multiple purposes, but what do I mean by this?
Currently, I have three places:
- Lobby: The main place in charge of letting the players edit their character and decide which game option to play.
- PvP Game: One of the options offered by the lobby for players to play.
- No-PvP Game: One of the options offered by the lobby for players to play; however, this place automatically removes specific ores, disables PvP, and locks certain areas of the map.
What is the issue with this?
Every time I am willing to make a change to the game I have to edit both places PvP Game and No-PvP Game. In other words, I edit the PvP Game, and then I have to go to the No-PvP Game, delete all, and replace everything with the things in the PvP Game. Yes, both places use the same exact code, yet they act depending on the PlaceId
.
Have you tried anything else?
I have thought about using MemoryStore for me to tag servers; however, what if the other servers start first than what MemoryStore took to save the tag? To fix this issue, I would have to retry and wait for the server to receive its tag and then act according to it.
- Have in mind that requests could fail and the server will not be re-trying all the time and make the players wait.
- On the other hand, I would need to retrieve those servers using MemoryStore as well and use messaging service in order to know if that server is full or not to teleport players to existing servers. (Is a whole mess if you think about it and this is the main issue why I am requesting this feature)
Using Player:GetJoinData() could be used for transferring the Tag, yet I do not have a way to retrieve certain servers with those tags and know if I can teleport players to them unless I use really hacky ways.
How would tagging work?
To set a tag, TeleportOptions would offer us a new field called TeleportOptions.ServerTag
which is a string, and by default it has a Default
value. When teleporting players to that server, that Tag must be present in the server created.
To retrieve the tag from a server, TeleportService would offer us a function called TeleportService:GetServerTag()
. This function shouldnât yield at all and make a request, it should only retrieve the Tag that was given to the server when it was created, in other words, all that data must be present once the server starts. This function returns âDefaultâ if no tag was set.
How can this help you?
If Roblox is able to address this issue, it would improve my development experience because I could just use one place to handle everything. I would teleport players to the same place using different tags which would influence how the place would work.
Could other games benefit from this feature as well?
Yes! Imagine games that teleport players to a certain place because:
- Each place has a different difficulty. (Easy, Medium, Difficult)
- Start different games and maps, maybe a game like tower defense can benefit from it as well. (Having all maps in the lobby and they teleport the players to a reserved server with a tag indicating the current game play.)
For example:
The Lobby will run the code below when a player wants to play in a No-PvP server. Have in mind that if a server exists with such Tag and the player is able to join it, Roblox should teleport the player to it like they normally do to any server. However, if no server with such a Tag exists, then they should create a new one and teleport the player to the new server with such Tag.
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local PlaceId = 0000000
local PlayerList = Players:GetPlayers()
local TeleportOptions = Instance.new("TeleportOptions")
TeleportOptions.ServerTag = "No-PvP"
TeleportService:TeleportAsync(PlaceId, PlayerList, TeleportOptions)
The other place will run this code once the server starts in a Script:
local TeleportService = game:GetService("TeleportService")
if TeleportService:GetServerTag() == "No-PvP" then
--> Delete.
--> Disable.
--> Lock.
--> Change.
--> Etc, whatever you wanna do according to that Tag.
end
This way I wouldnât need to have âhundredsâ of places just for one simple task.
Thank you.