So I got the teleportation working, but now the problem is since they get teleport4d to a private server when they join the game, it goes into a constant loop. How would I make it so that when the player joins, it knew teleports them once and then not again.
Or how would you guys create a main menu system where only your character shows up and not everyone else’s as well. Cuz if it was in a server with other people, you would see other people’s characters on the home screen as well.
I would create a main menu system by learning to code, make minimalistic effort, appreciate my current development efforts but tell myself to improve more.
I know how to code. I have already written a fully functioning and saving character customization system that worked, but wasn’t that efficient in ways that it was over 1000 lines long.
Remind me what exactly your post is about then? Seems like you are experiencing trouble but are also turning it into a Q&A halfway through! Show us the script you believe is causing you trouble and make it clear.
Just check if its a private/reserved server using this line of code
local isReserved = game.PrivateServerId ~= "" and game.PrivateServerOwnerId == 0
if isReserved then
--stuff that you want to happen once the player is in a private server
end
What that may actually work. If it checks and sees its a reserve it won’t teleport
again. I’ll try that. But also like what about when they re enter the public servers how would I then stop them from getting moved to a private server and not have them return to the main menu? Cuz the game automatically sets the camera to the main menu scene so when they boot back into the public servers and spawn, how would I make it so that the game doesn’t bring them back to the character customization scene.
Use a datastore to keep track of the type of server they’re in. I actually made a similar system to yours for a party and lobby system for my game, and what I did was use a few datastores that reflect the player’s reserved server id, the id of the player that last invited them. Mine was different, however, because I made it so that when you got invited, you would just join the player that invited you’s reserved server by using something similar to this.
local plrthatinviteduserid = datastore:GetAsync(player.Userid.. " inviter")
TeleportService:TeleportToPrivateServer(placeid, datastore:GetAsync(plrthatinviteduserid.." server id"), {player})
Here is the DataStore documentation, Data Stores (roblox.com), it is a bit underexplained and confusing, so if you need extra documentation I’ll give you a few more examples.
If you just want to make it so that the player gets teleported into the actual game, just make the actual game a different place and attach it to the game using Asset Manager > Places. Hope this helps, and please reply if you have any other questions!
What loop? Each server runs its code for itself, so this loop wouldn’t even apply to all servers, which isn’t what they want because they want to teleport the player back into public servers which means its not guaranteed that they will be in the same server.
The code is in a playeradded function. Therefore, when a player joins the game, they get sent to the private server, but since this code gets fired when a player is added, the player will keep getting sent to another server. It is a loop