Do I need to make this a 3d array?
It is not cycling through all of the objects
error:
Workspace.Bait.Spawn1.Robot.Script:37: attempt to index nil with 'className'
This script is supposed to cycle through all the children and pick out the right objects. Why is not all the children being sorted through?
local list = {
game.Workspace.ZednovTycoonKit.Tycoons.Castle2.PurchasedObjects:GetChildren() ,
game.Workspace.ZednovTycoonKit.Tycoons.Castle4.PurchasedObjects:GetChildren() ,
game.Workspace.ZednovTycoonKit.Tycoons.Castle3.PurchasedObjects:GetChildren() ,
game.Workspace.ZednovTycoonKit.Tycoons.Castle1.PurchasedObjects:GetChildren()
}
local temp2 = nil
for x = 1, #list do
if (list[x].Name == "Spawn1") then
temp2 = list[x].Robot
end
if (list[x].Name == "Spawn2") then
temp2 = list[x].Bull
end
if (list[x].Name == "Spawn3") then
temp2 = list[x].EvilGiant
end
if (list[x].Name == "Spawn6") then
temp2 = list[x]
end
if (list[x].Name == "Walls1") then
temp2 = list[x]
end
if (list[x].Name == "OwnerOnlyDoor") then
temp2 = list[x]
end
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
other section of the script is not necessary