How To Save A Character When Teleported to a different server?

  1. so when someone changes there character in a main lobby and then they want to play the main game there character gets saved so the script can load it in the new server

  2. ive tried using teleport data with HumanoidDescription but it prints out lighting its like its not there for the server

  3. ive tried most of the things i can’t find much on the wiki and dev forums and not much on yt

if anyone can help me that would be great!

4 Likes

You can’t send instances through teleport data.

Instead, you would want to make a table and send it that way, ie:

{12345, 12345, 12345, "blue"}

All you have to do is put the values you need to save in a table and send that instead, then take those values and use them on a created humanoid description.

3 Likes

okay i will try this out thanks!

If you are using universes you can use Datastores, this will also let your player have their character auto loaded whenever they join the main game if you want it to.

okay. would i have to save the HumanoidDescription? before they leave and when they come back it loads the recent HumanoidDescription? or would i have to save everything in the model like hats ect? i dont know a correct way of doing this sorry.

1 Like

cc @Tom_atoes
Using data stores for going from place to place isn’t reliable; And it requires lots of checks to make sure data loads correctly, and if it doesn’t then you have even more problems.

For simply sending customization data, I would just use TeleportData. If you want player’s customization to save when they leave the game, then implement data stores.

1 Like

i did try to import the HumanoidDescription table data but it loads the character black

Could you show your code? I can’t really diagnose this problem as it could be a number of things.

sure thing here

LOCAL SCRIPT

script.Parent.MouseButton1Click:Connect(function()
	local ts = game:GetService("TeleportService")
	local data = {
		workspace.HumanoidDescription.HairAccessory,
		workspace.HumanoidDescription.Face,
		workspace.HumanoidDescription.GraphicTShirt}
	ts:Teleport(4612082724,game.Players.LocalPlayer,data)
end)

Local script pick up teleportdata

local ts = game:GetService("TeleportService")

local data = ts:GetLocalPlayerTeleportData()

if data then

game.ReplicatedStorage.RemoteEvent:FireServer()

end

SERVER SCRIPT

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr,data)
	wait(5)
	print("made description")
	local humanoid_Description = Instance.new("HumanoidDescription")
	wait(1)
		print("named it")
	humanoid_Description.Name = "HumanoidDescription"
		wait(1)
			print("in workspace")
	humanoid_Description.Parent = game.Workspace
		wait(1)
			print("put the data on it")
	humanoid_Description = data
		wait(1)
		print("load on character")
    plr:LoadCharacterWithHumanoidDescription(workspace.HumanoidDescription)
wait(1)
script.Disabled = true
end)

I’d just like to point one thing out here, you never pass anything to the fire server function.

1 Like

oh no wait let me add it

just adding characters

hmm still the same problem

I feel like an issue might occur here because at this point your setting the variable as the data you passed to it, instead of setting the properties of the object itself.

yeah,Same So how would i use multiple tables but only put 1 part in the table on there ?

Personally, if you’re going to do something of this nature, I’d use dictionaries to make it easier.

You’d want to pack the data table.

local data = {
    ["HairAccessory"] = workspace.HumanoidDescription.HairAccessory,
    ["Face"] = workspace.HumanoidDescription.Face,
    ["TShirt"] = workspace.HumanoidDescription.GraphicTShirt
}

and now that you have the dictionary of said info, pass that, and then when creating the object server sided you go through and set

humanoid_Description.HairAccessory = data["HairAccessory"]
humanoid_Description.Face = data["Face"]
humanoid_Description.GraphicTShirt = data["TShirt"]

or something along this nature.

ohhh okay thanks for the explanation too

No problemo, hopefully it works. Never really made something like this; However I’m pretty sure they added a Server Sided TeleportData table now, so I’d look into that instead of letting the client control what they wear etc.
Info can be found here: Serverside method of getting player teleport data

yeah ive tried that out it did not go so well also


it works!! thanks so much for your time and help btw

1 Like

Happy to help, if you have any problems in the future my messages are always open, and I’ll help the best I can.

1 Like

just a quick thing i ran into ive tried alot of things like destroying disable debounce and it still keeps spamming the character respawn https://gyazo.com/b891b28f146a5f4d67d011e3f82ab8bf