I looped using "for" in a model to get some specific parts

For example I have:

GenerationPoint 1, GenerationPoint 2

To determin them I used string.find(part.Name, "GenerationPoint") but for some reason "part" is nil?

for i, generationPoint in pairs(room:GetChildren()) do
		if string.find(generationPoint.Name, "GenerationPoint ") and generationPoint.Name~= "GenerationPoint "..string.split(randomTrigger.Name, " ")[2] then
			generationPoint:Destroy()
		else
			generationPoint.Name = "GenerationPoint"
		end
	end

Error's at line 2, the first kriteria

Error: Line 2: attempt to concatenate string with nil

Any help would be great!

1 comment

0

what is the randomTrigger variable?