local chunkpieces = script.Parent.ChunkPieces:GetChildren("ChunkPiece")
wait(0.5)--wait time after chunk is loaded to reduce lag
for i = 1,25 do
wait(0.1)
if chunkpieces[i]:IsA("Model") and chunkpieces[i].Name == "ChunkPiece" then
b = math.random(#chunkpieces)
local randompart = chunkpieces[b]
randompart.IsEnabled.Value = true
end
end
this script goes through a model which contains lots of other models, each of those other models is a group of parts. an error occurs and the for loop only runs once.
the error:
Workspace.AreaChunk3.CoreManager:6: attempt to index field '?' (a nil value)

1 comment
GetChildren() is a table not a spcific target, it gets all the children