How to transport data between places with teleport service?

Hey, developers!

So I had a pretty simple question, but I can’t find any clear answers on it. I want to make a system that teleports players to a different place and when they are teleported, they play the game. Players are then teleported back to the main place and are given coins based on how far they have made it through the game.
If you don’t understand what I’m talking about, I’m trying to create something like Flicker or Tower Defense Simulator where player are teleported to a game and earn money or a win (or any other leaderstats value) and then get teleported to the starting place with the awards that they earned.

I’ve done research about saving sensitive data such as coins, between places but have been told that it’s extremely unsafe, so I’m asking you guys how I would go about this. I’m not asking for code, but just how to save coins or other leaderstats between two different places.
Some solutions that I’ve thought of are saving the wave or how far the player made it through the game and transporting that data as a string or integer back to the main place, rewarding players with coins. I’m guessing that this is what I should do, but just in case there is a better way, any help is appreciated.

Thanks so much for your time!

-dodle :grinning:

1 Like

Datastores are the same in your game, even though you teleport a player to another place of your game

1 Like

It is possible with:

local tps = game:GetService(“TeleportService”)
tps:Teleport(gameid, playertoteleport, data) (eg. tps:Teleport(1234, game.Players.LocalPlayer, “cheese”))

To retrieve the data in the game the player teleported to, use:

tps:GetLocalPlayerData()

I’m not sure if you know what I’m talking about. I guess I wasn’t so clear, but I want to transport data between places, not save it.

oops srry :sweat_smile: but your topic title is quite misleading…

Is there any way to do something like this in a normal script? I want to make a table/queue which I can only do in a non-local script. I’m guessing I would have to use remote functions though, right?

That’s fine. I’m not the best at explaining things.

One option you could try is saving data to a “toBeSaved” data store. When the player joins the main game their coins are moved from toBeSaved to their coins data store. toBeSaved would then be cleared. (Correct order: set tbs, teleport player, clear tbs, if success then add to their data store)

Another option is you can just increase their coins in the middle of the game they are playing(data stores are at the universe level so they can be accessed from places in the same universe)

1 Like

While this option is good for things like settings, teleportation data is local. If someone tried something like this with coins people could change their coin values to large amounts and have infinite coins.

1 Like

You can get teleport data on the server side by using Player:GetJoinData

I never knew that. Thanks for the help! I’ll try this out.