GetJoinData not working from TeleportToPrivateServer

I am trying to make an “edit game” type script and I am trying to make it detect if the player is editing and prints if it got detected, but it doesn’t work. Here is the lobby server script:

elseif action == "play" or action == "edit" then
		if player:GetAttribute("IsTeleporting") then return end
		player:SetAttribute("IsTeleporting", true)
		local gameEntry = findGame(player.UserId, gameId)
		if not gameEntry then player:SetAttribute("IsTeleporting", nil) return end

		if not gameEntry.PrivateServerCode then
			local ok, code
			ok, code = pcall(function()
				return TeleportService:ReserveServer(placeId)
			end)
			if ok and code then
				gameEntry.PrivateServerCode = code
			else
				player:SetAttribute("IsTeleporting", nil)
				return
			end
		end

		local spawnData = {}
		if action == "edit" then
			spawnData.EditMode = true
		end

		local success, err = pcall(function()
			TeleportService:TeleportToPrivateServer(placeId, gameEntry.PrivateServerCode, {player}, spawnData)
		end)

		task.delay(5, function()
			if player and player.Parent then
				player:SetAttribute("IsTeleporting", nil)
			end
		end)

Editing game server script:

game.Players.PlayerAdded:Connect(function(player)
	local joinData = player:GetJoinData()
	if joinData.SpawnData and joinData.SpawnData.EditMode then
		print("Player is in edit mode")
	end
end)
1 Like

Couldn’t find anything to fix this yet and I haven’t heard from anyone how to fix this issue

1 Like


there is no spawndata property in the joindata dictionary, did you mean TeleportData?
Always refer to the documentation first: Player | Documentation - Roblox Creator Hub
Hope this helps.

1 Like

Use TeleportAsync it replaces every other teleport method, and use TeleportOptions with :SetTeleportData

1 Like

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