I'm developing a ROBLOX game which heavily depends on teleporting (for matchmaking). But there's one problem. My lobby won't EVER teleport me to my game! It keeps on telling me:

Teleport failed because Cannot find game server (GameNotFound)

Does anyone know how to fix this? This is my code that handles teleporting:

LocalScript (On UI)


script.Parent.MouseButton1Click:Connect(function()
	
	--handler for gamemode
	local loadingScreenName = script.Parent.Parent.LoadingScreenName.Value
	
	local teleportArguments = {}
	
	--teleport to respective gamemode
	game:GetService("ReplicatedStorage").RemoteEvents.TeleportTo:FireServer(1799905865, 0, game.ReplicatedStorage.LoadingScreens.Solos:FindFirstChild(loadingScreenName))
end)

Server script (Actually teleports the player):

local rep = game:GetService("ReplicatedStorage")
local tpEvt = rep.RemoteEvents.TeleportTo

local TeleportService = game:GetService("TeleportService")
TeleportService.CustomizedTeleportUI = true

local function TeleportPlayerTo(player, placeId, teleportData, loadingScreen)
	if teleportData~=nil then
		if loadingScreen~=nil then
			TeleportService:Teleport(placeId, player, teleportData, loadingScreen)
		else
			TeleportService:Teleport(placeId, player, teleportData)
		end
	else
		if loadingScreen~=nil then
			TeleportService:Teleport(placeId, player, nil, loadingScreen)
		else
			TeleportService:Teleport(placeId, player)
		end
	end
end

TeleportService.TeleportInitFailed:Connect(function(plr, teleportResult, errorMessage)
	print(plr.Name.." failed to teleport.")
	print("Error: "..errorMessage)
end)

tpEvt.OnServerEvent:Connect(TeleportPlayerTo)

2 comments

0

The client can teleport itself; the remote event is useless. Also, are you sure the placeId is 170? I highly doubt that as that gives me a 404.

0

The id isn't 170, click view source as the line doesn't display correctly (I have no idea why.) And I know that you can via local script, but the server must manage teleporting because parties.