How to make place oly joinable from main game teleport service (place underneath a game)

You can write your topic however you want, but you need to answer these questions:

Note: im not sure what category this should be in, if its incorrect, please notify me.

  1. What do you want to achieve? Keep it simple and clear!
    having a place thats isnt joinable from friends list and is only joinable from using teleport service from the main game

  2. What is the issue? Include screenshots / videos if possible!
    image_2024-08-08_104007435
    the middle one is the main game. im not completely sure what to do to actually get the desired results for this

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    ive looked and looked but the only thing ive seen is game to game, rather then main game to place

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local part = script.Parent

part.Touched:Connect(function(toucher)
	if game.Players:GetPlayerFromCharacter(toucher.Parent) then
		if game:GetService("BadgeService"):UserHasBadgeAsync(game.Players:GetPlayerFromCharacter(toucher.Parent).UserId,2332683555832142) and game.Players:GetPlayerFromCharacter(toucher.Parent):FindFirstChild("Stage2") then
		local player = game.Players:GetPlayerFromCharacter(toucher.Parent)
		game:GetService("TeleportService"):TeleportAsync(18590823423,{player})
		end
	end
end)

heres the code used for the teleporting, though i dont think this is nessacary

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

and like i said up top, i dont completely know what category this should be in. so please correct me

3 Likes

Try to make places private, you can still join them through public places as i know. Making a game accessible only through a teleporter - #2 by Ty_Scripts

1 Like

how exactly do i do that though? i cant find an option for that and going into the place and setting it, sets the main place aswell

2 Likes

you need to open your place in roblox studio then in roblox studio’s game settings>Permissions then set it at private. That should work, im pretty sure that roblox still havent removed that.

1 Like

Or you can just send teleportation data with some unique key then checking the key in the place, if player does not have key or key is incorrect then kick him.

2 Likes

this sets the main game to private aswell
image_2024-08-08_105252249

1 Like

My bad then, it was probably removed or it was false memory. Try to send teleportation data with some unique key then checking the key in the place, if player does not have key or key is incorrect then kick him.

2 Likes

how exactly would i do this?
im not very experienced in teleport service and data

2 Likes

Place script (server-side):

local Players = game:GetService("Players")

local function onPlayerAdded(player:Player)
	pcall(function()
		joinData = player:GetJoinData()
		teleportData = joinData.tpdata
		key = teleportData.key
	end)
	for _,v in pairs(joinData) do
		if typeof(v) == 'table' then
			for _,k in pairs(v) do
				key = k
			end
		end
	end
	if key then
		if key == 'im from da redirect game trust me script plsπŸ₯ΊπŸ₯Ί' then
			
		else
			player:Kick('no access')
		end
	else
		player:Kick('no access')
	end
end

Players.PlayerAdded:Connect(onPlayerAdded)

Script to teleport (server-side):

local teleportOptions = Instance.new("TeleportOptions")

local tpdata = {
	key = "im from da redirect game trust me script plsπŸ₯ΊπŸ₯Ί";
}
teleportOptions:SetTeleportData(tpdata)
game:GetService('TeleportService'):TeleportAsync(PlaceID,{Player},teleportOptions)

Alright, just implemented it and im going to go ahead and test it. Thank you for the help!

1 Like

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