I was curious on how someone would be able to “filter” roblox to just only games as a random game generator, not a random model or anything else.
Code:
local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")
while wait(10) do
local rnger
local PlaceID
local success
repeat
rnger = math.random(100000, 1000000000)
PlaceID = rnger
success = pcall(function()
return MarketplaceService:GetProductInfo(PlaceID)
end)
task.wait()
until success
local thumbnail = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid="..PlaceID .."&fmt=png&wd=420&ht=420"
local surfacegui = script.Parent.Parent.Parent.SurfaceGui
local Placename = MarketplaceService:GetProductInfo(PlaceID)
surfacegui.Thumbnail.Image = thumbnail
surfacegui.PlaceName.Text = Placename.Name
script.Parent.MouseClick:Connect(function(player)
TeleportService:Teleport(PlaceID, player)
end)
end
local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")
local GetInfo = function(id)
local PlaceID = id
local thumbnail = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid="..PlaceID .."&fmt=png&wd=420&ht=420"
local surfacegui = script.Parent.Parent.SurfaceGui
local Info = MarketplaceService:GetProductInfo(PlaceID,Enum.InfoType.Asset)
if Info.AssetTypeId == 9 then
surfacegui.Thumbnail.Image = thumbnail
surfacegui.PlaceName.Text = Info.Name
return PlaceID
end
end
local function GetRandomPlace()
local rnger = math.random(100000, 2147483647) -- you CAN'T go any higher than this or it won't work
local success, PlaceId = pcall(function()
return GetInfo(rnger)
end)
if success and PlaceId then
script.Parent.MouseClick:Connect(function(player)
TeleportService:Teleport(PlaceId, player)
end)
else
GetRandomPlace()
end
end
while task.wait(10) do
GetRandomPlace()
end
Did you copy my exact code and use it? There should be no way it could still show models and shirts when the only asset with an AssetTypeId of 9 is a place.
local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")
local GetInfo = function(id)
local PlaceID = id
local thumbnail = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid="..PlaceID .."&fmt=png&wd=420&ht=420"
local surfacegui = script.Parent.Parent.SurfaceGui
local Info = MarketplaceService:GetProductInfo(PlaceID,Enum.InfoType.Asset)
if Info.AssetTypeId == 9 then
surfacegui.Thumbnail.Image = thumbnail
surfacegui.PlaceName.Text = Info.Name
return PlaceID
end
end
local function GetRandomPlace()
local rnger = math.random(100000, 2147483647) -- you CAN'T go any higher than this or it won't work
local success, PlaceId = pcall(function()
return GetInfo(rnger)
end)
if success and PlaceId then
script.Parent.MouseClick:Connect(function(player)
TeleportService:Teleport(PlaceId, player)
end)
else
GetRandomPlace()
end
end
while task.wait(10) do
GetRandomPlace()
end
Aah… Haha, I was going to ask that next. Yeah, wasn’t sure if there was maybe any extra code that could’ve interrupted or caused issue. Well, glad this helped!