Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is it concatenating string with nil?

Asked by 1 year ago

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!

0
what is the randomTrigger variable? loowa_yawn 383 — 1y

Answer this question