Teleport Service and Data bugging?

Hi, I’m trying to make a demon slayer sort game kinda like project slayers. I’m at a part in my coding where I just can’t find a soulution to, so thats why im posting here as a last resort. I made a character customization which is a seperate place from the main game. I’m trying to send over data using teleport service to the main game.

Game 1: (Server)

local TeleportService = game:GetService("TeleportService")


local function teleportPlayer(player)
	local characterModel = player.Character
	local characterData = characterModel

	local teleportData = {
		characterData = characterData
	}
	TeleportService:Teleport(15641747325, player, teleportData)
end

event.OnServerEvent:Connect(function(plr)
	teleportPlayer(plr)
end)

Game 2: (Client)

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

if teleportData and characterData then
	print("Character Model:")
	print(characterData)
	
	local current = workspace[player.Name]
	current:Destroy()
	player.Character = nil
	player.Character = characterData
	characterData.Parent = game.Workspace
	else
	error("Error with data")
end

Any feedback is appreciated!

Why not use DataStoreService for this?

how would i implement datastore into this?

To teleport to places, you should you teleport service and to save data across the same place, you need datastore service

Datastore saves anything that you send to the roblox server to be accessed later, ie in another place

oh so if I make a datastore in one of the places I can access that data store in a different place?

That is correct, I recommend this video https://www.youtube.com/watch?v=n1UpT2csAzo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.