Locking your game behind a link

Link Locking

Hey there! Looking to QA test your game, or have your friends try a game before it releases? How is it possible to restrict access to users who you don’t have added, or aren’t in your group?

Recently, Roblox released developer deeplinking, which makes it possible to set launch data through a link.

Creating The Code

Your first step is to create a server script in ServerScriptService!

Below is some well-commented code you can tinker with. Put this code in your new script!

local PlayersService = game:GetService("Players")

local KickMessage = "You do not have permissions to join this experience." -- The frontfacing kick message an invalid player sees
local JoinDataKey = "link-unlock" -- Matches the information after "&launchData="

PlayersService.PlayerAdded:Connect(function(Player)
	local JoinData = Player:GetJoinData().LaunchData
	-- LaunchData is a property of JoinData
	
	if JoinData then -- Does the join data exist?
		if JoinData == JoinDataKey then -- Is the join data equal to what we want?
			-- The launch data matches JoinDataKey, output a message signifying a join!
			warn(Player.Name .. " has joined the experience")
		else
			-- The launch data is incorrect, kick!
			Player:Kick(KickMessage) 
		end
	else
		-- There is not any launch data, kick!
		Player:Kick(KickMessage)
	end
end)

Creating the Link

The link to safely join your game should look something like this:
https://www.roblox.com/games/start?placeId=(PLACEIDHERE)&launchData=link-unlock

Replace (PLACEIDHERE) with the place id of your game!

To break down the link,

  • https://www.roblox.com/games/start signifies to roblox that the game is to be opened immediately,
  • ?placeId=(PLACEIDHERE) signifies what game is to be played,
  • and &launchData=link-unlock sends a payload of data; in this case, “link-unlock”.

To Sum it Up

This is a super simple way to lock your game behind a link. As long as you’re not worried about the link being leaked, you can customize it how you want and share it with those you trust.

Thanks for the read!

85 Likes

Thanks for the tutorial! Very well-made.

I honestly didn’t know you could do this.

On a side note, I personally love all the things you can do with Developer Deeplinking. So many use cases. :slightly_smiling_face:

7 Likes

Will definitely be using this for my game! Great tutorial

2 Likes

How would you go about making not the game link locked, but a place inside the game?

Could you elaborate on what you mean by this?

I want to make a developer testing place in one of my games and it would be useful to have a link I can share with the other devs.

1 Like

You mean like a place inside the game?

By place I mean using the Place API, not a specific location inside the game.

So you want the game locked without a link, but with Place API?

The Link isn’t working…

It says there was a problem with your request.

Did you put the code in server script service?

Yes, And it’s also a Server Script.

Did you put your own place id in the link?

Yes.
But it still doesn’t work!

Where is rblx template?
I’m sure Normal boot can’t do

Mind showing me what you did for the link?

What do you mean by normal boot?

IT JUST WORKED!
I just had to remove the brackets!

it was very confusing, i’d recommend to remove them

1 Like

never thought this would even be possible

my brain cannot comprehend this

thank you very much

1 Like

love this usecase of developer deeplinking! keep them coming :smile:

8 Likes