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)
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.
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.
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
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)