How would you be able to filter out specific words when finding a random game?

Hello
I was curious how you would be able to filter out key words in my random game generator because a lot of the games have the word “place” in it, which is something like BlueClothesPerson's place. How would I be able to find the word “place” any where in the text, and if it sees that word, it would try finding a new experience.

Current Script
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.Parent.SurfaceGui
	local Info = MarketplaceService:GetProductInfo(PlaceID,Enum.InfoType.Asset)
	local CreationDate = MarketplaceService:GetProductInfo(PlaceID)

	if Info.AssetTypeId == 9 then
		surfacegui.Thumbnail.Image = thumbnail
		surfacegui.PlaceName.Text = Info.Name
		surfacegui.CreationDate.Text = Info.Created
		surfacegui.LastUpdated.Text = Info.Updated
		surfacegui.Visits.Text = Info.Description
		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
2 Likes

a repeat loop should work for this

name = ""
repeat
 -- get randomplaceinfo

name = "some world" -- make the place name the name variable
task.wait()
until not string.find(string.lower(name), "place")
1 Like