This is a little embarrassing to ask considering how long I’ve been doing this but is there an easier way to write a code like this?
for i = 1,#Grids do
for j = 1,#SelectedGrids do
for k = 1,#SelectedGrids[j] do
if Grids[i].Name == SelectedGrids[j][k][1] then
local SB = Instance.new("SelectionBox")
SB.Adornee = Grids[i]
SB.Parent = Grids[i]
end
end
end
end
table.foreach is a legacy API from the pre-Lua 4.0 era; you should avoid using table.foreach if possible as it’s deprecated(!) in Lua 5.1 (the version Luau is based on) and was removed in Lua 5.2.