✓ Accepted answer
You can detect if a string contains something by using the string.find() function.
It takes in two parameters, the string, and the string inside that you want to find.
Here is an example of it in use:
local str = "Hello world!"
if string.find(str, "Hello") then
print("This code will run, because str contains Hello.")
end
We can then loop through all objects in the Workspace by using the GetChildren() function, and we can check if the object contains "ticket" in the name.
Should look like this:
for _,object in ipairs(workspace:GetChildren()) do
if string.find(object.Name, "ticket") then
object:Destroy()
end
end
This article should teach you about some other string functions.
Hope this helped