I am making a script inside TextButton script that will check if the TextBox contains any of the word or string inside the table.

text = script.Parent.Parent:WaitForChild('TextBox')
label = script.Parent.Parent:WaitForChild('TextLabel')

a = {'ziploz','flyemirates27','groovydominoes52'}

script.Parent.MouseButton1Click:connect(function()
	if string.match(text.Text, a) then
	label.Text = "The word "..text.Text.." was found in the table."
else
	label.Text = "The word "..text.Text.." was not found in the table."
end
end)

What's the right way to do it?

3 comments

0

Instead of "if string.match(text.Text, a) then" try "if text.Text:match(a) then"

0

It shows an error "String expected, got table", Is there any way to get all text in the table?

0

how about string.match(text.Text, "a")