Teleport validation failed?

  1. What do you want to achieve? Keep it simple and clear!
    Make a place roulette game.

  2. What is the issue? Include screenshots / videos if possible!
    A lot of times the teleport fails, and when I open the console it says “Teleport validation failed” even though the place is public and I can join it

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried making sure the games were public and there is no solutions in the Dev Hub.

local mps = game:GetService("MarketplaceService")
local ts = game:GetService("TeleportService")
local db = false

local function getRandomPlaceId(): number
	local randomPlaceId = math.random(1, 999999999)

	local success, info = pcall(mps.GetProductInfo, mps, randomPlaceId)

	if (success == true) and (info.AssetTypeId == 9) and not string.find(info.Description, "This is your very" and "creation") and info.Name ~= info.Creator.Name.."'s Place" then
		return randomPlaceId
	else
		return getRandomPlaceId() 
	end
end

local id = getRandomPlaceId()

script.Parent.Touched:Connect(function(part)
	if db == false then
		local plr = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)

		if plr then
			db = true
			ts:Teleport(id, plr)

			task.wait(2)

			db = false
		end
	end
end)

This is the code (some epic guy gave it to me)

1 Like

To add on, the teleport works a few times, but most times it just pops up that message.

Maybe because some of the places/games don’t allow teleports from other games, if they are your own game you can go to:
Roblox Studio → The Game/Place → Game Settings → Security → Allow Third Party Teleports → Enable it
For other games you can ask the owner, or developer of the game to do it, if they allow it.

Hm, how would I make a game like super place roulette then?

1 Like

Can you explain your vision more clearly?

Well, the game should find a random game and teleport the user to it, just like super place roulette.

Basically a random game finder.

You have the basis for it, but you would need to get rid of games that don’t allow third party teleports or check for it by script.

How would I do that?


TeleportService | Documentation - Roblox Creator Hub
Here is a doc on how to check for teleport service error.
You see some games might even turn on third party teleport so… I wouldn’t suggest eliminating those that don’t permanently, instead use this event that would fire if the teleport went wrong, if it did just try to find another place/game for them to teleport to.

Here let me type up a script real quick as an example.

Alright.


Ok give me one second to test this fix. By the way you would wanna check if the part that touch the part is a player by checking if

if part.Parent:FindFirstChild("HumanoidRootPart") ~= nil then

end
local mps = game:GetService("MarketplaceService")
local ts = game:GetService("TeleportService")
local db = false

local function getRandomPlaceId(): number
	local randomPlaceId = math.random(1, 999999999)

	local success, info = pcall(mps.GetProductInfo, mps, randomPlaceId)

	if (success == true) and (info.AssetTypeId == 9) and not string.find(info.Description, "This is your very" and "creation") and info.Name ~= info.Creator.Name.."'s Place" then
		return randomPlaceId
	else
		return getRandomPlaceId() 
	end
end

local id = getRandomPlaceId()

script.Parent.Touched:Connect(function(part)
	if db == false then
		local plr = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)

		if plr then
			db = true
			ts:Teleport(id, plr)

			task.wait(2)

			db = false
		end
	end
end)
--Addition:
ts.TeleportInitFailed:Connect(function(plr)
	id = getRandomPlaceId()
	ts:Teleport(id, plr)
end)

Try this and make sure your not in studio when testing this.

I don’t think so I know of such function, I rarely use teleportService in such a way, maybe with more research there could be one, but not that I know of within my knowledge.

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