I am nearly done with my random game generator, but I want the genre to be displayed to potentially filter out games by horror, building, etc… How would I go by doing this?
And if possible, how would I be able to find the creator’s profile and username via a Roblox Place ID?
Script
local TeleportService = game:GetService("TeleportService")
local MarketplaceService = game:GetService("MarketplaceService")
local GetInfo = function(id)
local thumbnail = "https://assetgame.roblox.com/Game/Tools/ThumbnailAsset.ashx?aid=".. id .."&fmt=png&wd=420&ht=420"
local Info = MarketplaceService:GetProductInfo(id,Enum.InfoType.Asset)
if Info.AssetTypeId == 9 then
return {
Name = Info.Name,
Created = Info.Created,
Updated = Info.Updated,
Description = Info.Description,
Thumbnail = thumbnail,
}
end
end
local Check = function(id)
local Info = MarketplaceService:GetProductInfo(id,Enum.InfoType.Asset)
if string.find(Info.Name, "Place") then
return false
end
return true
end
local IgnoredPlaceIds = {}
local function GRP()
-- Generates a Random Place
local RandomPlaceGenerator = Random.new():NextInteger(100000, 14038963653)
-- Checks for the word Place Before anything
if not Check(RandomPlaceGenerator) then
GRP()
return
end
-- Checks if the player has recieved this place before OR contains Place in it
if table.find(IgnoredPlaceIds, RandomPlaceGenerator) then
GRP()
return
end
-- This Line Make its so you cant get the same place your recieved before.
table.insert(IgnoredPlaceIds, RandomPlaceGenerator)
local success, errormessage = pcall(function()
-- Recieves Information Needed
local RecieveInformation = GetInfo(RandomPlaceGenerator)
-- Fills out returned information
local SurfaceGUI = script.Parent.Parent.Parent.SurfaceGui
SurfaceGUI.Thumbnail.Image = RecieveInformation.Thumbnail
SurfaceGUI.PlaceName.Text = RecieveInformation.Name
SurfaceGUI.CreationDate.Text = RecieveInformation.Created
SurfaceGUI.LastUpdated.Text = RecieveInformation.Updated
SurfaceGUI.Visits.Text = RecieveInformation.Description
SurfaceGUI.GameID.Text = RandomPlaceGenerator
SurfaceGUI.Genre.Text = RecieveInformation.Genre
end)
if not success then
warn(errormessage)
GRP()
return
else
script.Parent.MouseClick:Connect(function(player)
TeleportService:Teleport(RandomPlaceGenerator, player)
end)
end
end
while task.wait(10) do
GRP()
end