Save character appearance after joining a different game

I made 2 games, one was the lobby so the player could customize their appearance. The other was the actual game where the player press play in the lobby game after they finish customizing. I tried making the lobby as the start place of the actual game but the character didn’t save when I teleport them to the game.
lolxddddddd

My character customization system is just based on 2 things: Skin color and face. So I think if I link the actual game to the start place, which is the lobby then Roblox would save the character from the start place to the actual place?

I’m wondering how can I save the character appearance from the lobby and send that data to the actual game?

teleport functions have an argument for teleport data, with just a couple numbers passed, you can change their body on join of the game based on choices in lobby.

Teleport data

A teleportData parameter can be specified. This is data the client will transmit to the destination place and can be retrieved using TeleportService:GetLocalPlayerTeleportData .

The teleportData can take any of the following forms:

  • A table without mixed keys (all keys are strings or integers)
  • A string
  • A number
  • A bool

As the teleportData is transmitted by the client it is not secure. For this reason it should only be used for local settings and not sensitive items (such as the users’ score or in-game currency).

1 Like

Thanks for answering my question!

Anyway I’ve tested your method and also the Set and GetTeleportSettings, which can be found here: https://developer.roblox.com/en-us/api-reference/function/TeleportService/SetTeleportSetting
and https://developer.roblox.com/en-us/api-reference/function/TeleportService/GetTeleportSetting
but both method doesn’t seem to work. This is the script I put in a local script inside a ScreenGui:

local player = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local teleportData = TeleportService:GetLocalPlayerTeleportData()

local face = game.Players.LocalPlayer.Character.Head.face.Texture
TeleportService:SetTeleportSetting("face", face)

script.Parent.Spawn.MouseButton1Click:connect(function()
TeleportService:Teleport(3496476345, player, face)
end)

And this is the script I put in the place that receive the teleport:

local TeleportService = game:GetService("TeleportService")
local face =  TeleportService:GetTeleportSetting("face")

And none of the face data were saved. Can you help me if I was wrong somewhere?

The teleport service is for local scripts
GetTeleportSettings is called on the local player so if your script is running on server it returns nil

You can also try teleport data.

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

Origin

 local Players = game:GetService("Players")
 local player = Players.LocalPlayer
 local face = game.Players.LocalPlayer.Character.Head.face.Texture

 local teleportData = {
   ["face"] = face
 }
 TeleportService:Teleport(placeId, player, teleportData)

Destination (local script)

 local TeleportService = game:GetService("TeleportService")
 local teleportData = TeleportService:GetLocalPlayerTeleportData()
 if teleportData then
   local face = teleportData.face
 end)
2 Likes

thanks for answering again! …

A note that you should probably use Player.GetJoinData instead. Servers can retrieve teleport data, so you might be presented with some unnecessary overhead when doing it from the client. This includes the fact that the data is held locally.

In respect to this, that also means calling teleport methods with the server over the client. A case to handle is servers not seeing data or clients calling teleport methods.

Luckily, ephemeral DataStores are potentially in the making and might help out with this. On the roadmap, it lists ephemeral DataStores as temporary stores with high read and write speeds for cases such as matchmaking. This too could also work well with that, down the line.

2 Likes

That is quite useful. It should be linked from the teleport service API, specifically the GetLocalPlayerTeleportData() page. Stating its the location teleport data is reflected on the server.

But I agree, data stores would be much more practical than the back and forth with teleports.

1 Like

thanks for answering! i’m also testing with data store right now !