Hello everyone!
I’m making game where i added lobby and main game. It’s like apeirophobia lobby, players can create room, make it joinable with code, locked or unlocked for everyone, when players joins they need to press ready button and owner of this room can start the game (players getting teleported to other created place - main game). So, i want to make a choose map system (like in specter, owner choose map and after teleport this map is loaded), with it will be no problems, but when owner of the room will choose map, how to send it to place where they will be teleported? And also i don’t want to use local scripts beacuse hackers will can abuse it. Can somebody help me, please?
Is it another place they need to be teleported to, or a model to be loaded?
players getting teleported to the other place, i need to make this place know what map to load.
i will put maps to the replicated storage, i just need to make main game know what map needed to load.
The TeleportAsync from the Teleport service can be used to move players from one place to another.
However, if you want to just teleport the players to the new model from replicated storage, then call PivotTo.
PivotTo will allow you to move the players character seamlessly without problem to the target area.
One way is to either Have the map already existing in the place you are trying to send them, it is either stored somewhere, and when the Players are Teleported, you can Potetnially send a Piece of data across the two places.
Another way can be to use InsertService
, where you can have the Asset as a Owned Model, and Insert it into the Game using InsertService:LoadAsset()
with the relevant AssetId, if the Account or Group owns the asset, it will be insertted, otherwise it will return an error.
Put them in ServerStorage to secure them from hackers.
i don’t need to teleport players to map, i have 2 places: main game and lobby. owner of the room will choose map and players will teleport to the main game, but how to make the game know what map owner of the room choosed?
i didn’t want to know how to load map, i wanted to know what map owner of the room choosed. and also thanks for info about server storage! =)
i used teleport service in lobby to teleport players to other place - main game. how to give data to this place where players getting teleported?
so basically when the player creates the room, set them as the “Owner” of said room, and make sure to keep track of who it is, and which players own what room, check whether they are the owner so the game can decide whether they can vote for it or not, and when thats done, keep a reference of the map you want, likes its name for example, so when they are sent to the other place, you can then send that data across as well to grab the said map.
I believe you can send the Data using TeleportService:TeleportPartyAsync()
with its TeleportData
Argument
Can you please elaborate on how to do this?
if i will send data, how can i get this data in the main game?
TeleportService:TeleportPartyAsync(PlaceId, {PlayersInRoom}, TeleportData)
-- thats about all you are doing
You would either use DataStoreService
or GetLocalPlayerTeleportData
Sorry for ignore.
Can you write script that will get Teleport Data in the main game please? I don’t know how to use DataStoreService to get TeleportData.
Oh, and also i’m using ProfileService Module to make saving player data easier and with less bugs. Maybe i can use ProfileService with TeleportData too?
So, i found how to get TeleportData from Main Game. Thank you so much!
I forgot to say, that i’m using teleport service to teleport players to private server.
Who don’t know, we need to use as a TeleportData a table, and then in the other place we need to use PlayerAdded function and do player:GetJoinData() on the server sided script.
Lobby:
local server = tps:ReserveServer(0) --replace 0 to the place id where players are teleporting to
local plrs = {}
for i, plr in ipairs(game.Players:GetChildren()) do --getting every player on the server
table.insert(plrs, plr) --adding this player to the player list
end
local data = {["map"] = "Classic", ["SomethingYouWant"] = "SomethingYouWant"}
tps:TeleportToPrivateServer(0, server, plrs, nil, data) --also replace 0 to the place id where players are teleporting
Now server sided script from main game:
game.Players.PlayerAdded:Connect(function(plr)
local joinData = plr:GetJoinData()
if joinData then
local map = joinData["map"] --Classic
local AnyVariableName = joinData["SomethingYouWant"] --SomethingYouWant
end
end
I hope i helped some pople =)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.