Script not working like it should

Ok so, this is the line of code im having problems with:

local node = nodes[tonumber(previousNode.Name) + 1] or nodes.End

and here is the error:

6 is not a valid member of Folder "Workspace.Paths.Path1.Nodes"

There is no 6 in the folder indeed, so it should just use the nodes.End instead because of the or, right?
I tried using ifs but no results.
this is all in a function, only previousNode in this line is a paramater. And it isnt nil.

If a script errors, it completely stops. What I recommend you to do is put it in a pcall. OR you can use :FindFirstChild().

1 Like

FindFirstChild seemed to work. Guess i didnt think of using FindFirstChild lol. Anyways thanks

No problem!

bruh the minimum characters

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.