I’m making a utility and I want to know if this code is correct or can be improved.
function ServerUtilities:GetChunkNPCs(ChunkID)
local Chunk = ChunksFolder[ChunkID]
for i, ChunkData in pairs(Chunk:GetChildren()) do
local CurrentAsset = ChunkData:IsA("Model")
if CurrentAsset.Name:Match("NPC") then
return {CurrentAsset}
end
end
end
CurrentAsset is the return of the IsA method which is a boolean but then you used .Name which isn’t a valid item of a boolean, did you mean FindFirstChild?