local Colors = {
"Blue",
"Red",
"Green"
}
local Frames = script.Parent.Frames
for _,Frame in pairs(Frames:GetChildren()) do
if Frame.Name == Colors then
print(True)
end
end
I know it’s clearly because I’m just comparing the frame name
to a table, but how do I make it to where it compares the frame
name to one of the names inside the table?
Right now you’re checking if the name equals the entire array, you want to use table.find() to compare and check whether the iterated frame name exists in the Colors table.
local Colors = {
"Blue",
"Red",
"Green"
}
local Frames = script.Parent.Frames
for _, Frame in ipairs(Frames:GetChildren()) do
if table.find(Colors, Frame.Name) then
print(True)
end
end
local Colors = {
"Blue",
"Red",
"Green"
}
local Frames = script.Parent.Frames
for _,Frame in pairs(Frames:GetChildren()) do
if table.find(Colors, Frame.Name) then
print(True)
end
end