Teleport Service: How Do I Send Data Across Places?

Teleporting players is simple but teleporting their data seems to be an issue for me. In the game I’m working on, all players spawn in a hub and then select their magical class. However, when they party up and teleport to the actual place where the gameplay occurs, none of their classes carry over.

I’ve read up on TeleportService and MemoryStoreService, but I can’t begin to figure out where or how I would teleport these magical classes. Is it as simple as saving them as values within the player and teleporting them over?

1 Like

You can send data with TeleportService and receive with GetLocalPlayerTeleportData. You can perform the actual function by firing the server from client with the classes.

https://developer.roblox.com/en-us/api-reference/function/TeleportService/GetLocalPlayerTeleportData

https://developer.roblox.com/en-us/api-reference/function/TeleportService/Teleport

Not sure if this is what you are looking for.

It kind of is, but I’m still confused on how I would apply my classes and carry them over. For instance, this is the basic code I have to get players form point A to point B.

TeleportEvent.OnServerEvent:Connect(function(Player)
	print("Teleporting!")
	
	wait(5)
	TeleportService:Teleport(Place, Player)
end)

How would I then fire the server from the client as you said?

You can send the classes as some kind of values and receive them in Client. You would need to fire a server in the place from the client that receives the TeleportData. On the server, apply new TeleportOptions, make a table of your data. Set the TeleportData using your TeleportOptions and teleport the player with the TeleportOptions and then receive it with a localscript. LocalScript will perform the actual server firing using FireServer with the data passed as args. Hope this cleared something up.

Take a look at that.
https://developer.roblox.com/en-us/api-reference/function/TeleportService/GetLocalPlayerTeleportData