how would i create a place from code, something similar to towerdefence simulator,
how to i send info (i.e plr cash) to the place and how to send the information back. thx
You can send player data through :Teleport(placeId, Player, Data, CustomLoadingScreen), but from this video, he recommends not to send player data through the teleport service. You can probably use DataStores or the MessagingService to communicate data between servers.
ok, how bout creating place from script
Like loading in a place or what do you mean? Please elaborate.
I’m planning on creatings different game rounds where 2 players can join, I want to do something like local place1 = place:clone() or something like that
Creating server: TeleportService:ReserveServer()
Teleporting to server: TeleportService:TeleportToPrivateServer()
The example code of TeleportToPrivateServer shows how to use ReserveServer then TP to it too.
I’m not a professional in loading large instances, but you can possibly clone it and parent it to the workspace. I’m sure there are better methods out there, but you would probably need to find that yourself.
Oh so what that does it create a private server, returns a I’d to be placed in teleport service? Also what happens when I have diff maps
ReserveServer will make a new server of the whole game; maps and all.
Do you mean Places or in-game maps?
If you mean places, I’m pretty sure as long as the Places are within the same universe (use Game Explorer/Asset Manager depending if you use beta features) to link them, then instead of using game.PlaceId use the ID of the game you need to teleport them to.
One more thing, so get the place I’d to the past and creaye a private server in them right?
To get the ID of the private server, you would do:
local TS = game:GetService("TeleportService")
local code = TS:ReserveServer(gameIdHere)
print(code)
-- teleporting: (of course most likely in an event or after a wait or something)
TS:TeleportToPrivateServer(gameIdHere,code,game.Players:GetPlayers()) -- game.Players:GetPlayers() will teleport every player
If this isn’t what you mean, explain it for me in more detail.
Thank you sir/ma’am. Much appreciated