Say I'm looking for buttons within a GUI that have names pertaining to a certain code i.e the button's name is Button_1_RD where RD is a team's code. Could I use string.match to return true in an if condition?
Like follows:
local Buttons = {
RD1 = script.Parent.Button_1_RD,
BD1 = script.Parent.Button_1_BD
}
for _,v in pairs(Buttons) do
if string.match(v.Name, "RD") then
print(RD button found!)
end
end

1 comment
Thanks. I realised that if it returns nil it's functionally similar to returning false in an if condition.