Random Place ID Teleporter

How do i do a game like Super Place Roulette or Place Roulette?

Like i want like… The game chooses a random ID around the ROBLOX games. I don’t want that it chooses a Invalid or Private game ID like those two place roulettes.

I’ve tried making one but sometimes it got a valid ID but sometimes they are private.

Can someone tell how do i do to make this?

And also, This is my attempt creating one:

local TeleportService = game:GetService("TeleportService")
local RandomID = math.random(1, 1000000000)

script.Parent.MouseButton1Click:Connect(function()
	local RandomID = math.random(1, 1000000000) 
	print(RandomID)
	TeleportService:Teleport(RandomID, game.Players.LocalPlayer)
end)
1 Like

You could try making a datastore that whenever a player gets an invalid ID that it is added to the datastore, and whenever you get an ID you check if it’s on that datastore. For network prurpises you could have a local copy of the datastore as a table.

1 Like

You could also try what was used here:

3 Likes

I was on that post too tho…

But sure.

Well it worked! but i wonder how i do for place details…

SomeGuyFromFromADevForumSearch MarketplaceService:GetProductInfo() returns a dictionary that includes the description of the specified asset. The example below prints the description of Work at a Pizza Place.

print(game:GetService("MarketplaceService"):GetProductInfo(192800).Description)
1 Like

what code did you use? im having trouble trying to make it myself:

here’s mine

local TeleportService = game:GetService("TeleportService")

function IsGameValid(id)
	local isgame

	local success,message = pcall(function()
		local gameid = game:GetService('MarketplaceService'):GetProductInfo(id) 
		isgame = gameid.AssetTypeId == 9
	end)

	return success and isgame
end 

local randomID = math.random(1, 1000000000)

script.Parent.Touched:Connect(function(hit)
	local localplayer = game.Players:GetPlayerFromCharacter(hit.Parent)
	
	if IsGameValid(randomID) then
		print(randomID .. " is a valid place id; teleporting players...")
		TeleportService:Teleport(randomID, localplayer)
	else
		print("invalid place id")
	end
end)

it gives no error, but yet no teleportation.

the objective is to make whoever touches it get them teleported, but also so that it only runs it one time when the humanoid is on the part

Actually sometimes roblox doesnt teleport the player but, See if it prints the following print

Use the debounce trick, If its false, run the rest and activate debounce true

For this case, It would only turn back off if the pcall goes wrong.

so would this be the way to do it?

hint: im actually new to coding and just started getting into it

local TeleportService = game:GetService("TeleportService")
local canTp = false

function IsGameValid(id)
	local isgame

	local success,message = pcall(function()
		local gameid = game:GetService('MarketplaceService'):GetProductInfo(id) 
		isgame = gameid.AssetTypeId == 9
	end)

	return success and isgame
end 

script.Parent.Touched:Connect(function(hit)
	local randomID = tonumber(script.placeId.Value)
	local gameInfo = game:GetService("MarketplaceService"):GetProductInfo(tonumber(randomID))
	
	local tvScreen = game.Workspace.screen.SurfaceGui

	
	local localplayer = game.Players:GetPlayerFromCharacter(hit.Parent)
	
	if canTp == false then
		if IsGameValid(randomID) then
		
		
		print(randomID .. " is a valid place id; teleporting players...")
			TeleportService:Teleport(randomID, localplayer)
			
			-- info generator
			
			tvScreen.placeName.Text = gameInfo.Name
			tvScreen.placeIcon.Image = ("rbxassetid://" .. gameInfo.IconImageAssetId)
			tvScreen.placeCreator.Text = gameInfo.Creator.Name
			tvScreen.placeDescription.Text = gameInfo.Description
			
			
			canTp = true	
	else
		if canTp == true then
		print(randomID .. " is sadly an invalid place id; rerolling...")
				
			canTp = false
			wait(2)
			randomID = math.random(1, 3000000000)
			
		end
		end
	end
end)

it seems to still trigger after debouncing it

How could I detect if the random game id is public or not?
(also trying to make a game similar to OP)