Unable to detect Join Data

Hey there! I’m trying to make a feature for my game where users can share profiles to others! This is being done with Roblox’s deep linking feature, however the game keeps printing “no launch data” even though the launch data is on the url.

I’m looking to get the game to detect and read launch data (which is encoded).

Thanks in advance! :smile:


-- generate join data

local function encodeTableAsLaunchData(data)
	
	local HttpService = game:GetService("HttpService")

	local DATA_CHARACTER_LIMIT = 200

	-- convert the table to a string
	local jsonEncodedData = HttpService:JSONEncode(data)

	if #jsonEncodedData <= DATA_CHARACTER_LIMIT then
		-- escape potentially invalid characters, such as spaces
		local urlEncodedData = HttpService:UrlEncode(jsonEncodedData)
		return true, urlEncodedData
	else
		-- report character limit error
		return false, ("Encoded table exceeds %d character limit"):format(DATA_CHARACTER_LIMIT)
	end
end

-- show url on textbox
local success,url = encodeTableAsLaunchData(sharedata)
			if success == true then
				input.TextBox.Text = "https://www.roblox.com/games/start?placeId=16366216449&launchData={" .. url .. "}"
				input.TextBox.ClearTextOnFocus = false
				input.TextBox.TextEditable = false
				input.Parent = script.Parent.Frame
				input.Visible = true
				profilepage.Visible = false
				input.TextButton.MouseButton1Click:Connect(function()
					input:Destroy()
					profilepage.Visible = true
				end)
			end


-- detect & read join data
local launchData = game.Players.LocalPlayer:GetJoinData().LaunchData
	if launchData then
		-- attempt to decode the data
		local success, result = pcall(game:GetService("HttpService").JSONDecode, game:GetService("HttpService"), launchData)
		if success then
			print(game.Players.LocalPlayer.Name, "joined with data:", tostring(result))
			if result["From"] == "Profile" then
				LoadProfile(result["ID"], script.Parent.Frame.Home)
			end
		else
			-- this is probably due to the user messing with the URL
			warn("Failed to parse launch data:" .. result)
		end
	else
		print("no launch data")
	end