I have this loop and an if and elsif and it prints the contents of both
local function updateGrid(craftingItem)
if (workspace.craftingTables[player.Name].C3.Position - craftingItem.Position).Magnitude < gridDistance then
grid.c3 = craftingItem.Name
elseif (workspace.craftingTables[player.Name].C3.Position - craftingItem.Position).Magnitude > gridDistance then
grid.c3 = nil
end
print(grid.c3)
end
------->
for index, craftingItem in ipairs(workspace.grabs:GetChildren()) do
if craftingItem:IsA("Model") then
updateGrid(craftingItem.PrimaryPart)
elseif not craftingItem:IsA("Model") then
updateGrid(craftingItem)
end
end