Attempted to get length of instance value

This is extremely odd. I’ve done this math.random line a hundred times by now and encountered this error. I have no clue what’s wrong with it.

I’ve tried taking away the 1, in the line, just using math.random(#MapChildren) and it still gives me this error. It doesn’t make sense.

I’ve looked at other topics and none have the proper solution.

MapChildren is an instance in this case since it’s the value of a GetChildren table, I think you meant to do


Although I think you meant to use it on MapsFolder

1 Like

Got this error.

Are there even any children in the maps themselves? Again, did you mean to do just


Instead of an in pairs loop?

1 Like

No, no children inside the maps, they’re just parts. I tried the solution above and it didn’t seem to work.

Does it give you a different output or the same one?

Same output. Why does it have to be character limit

I don’t get the error now, but I doesn’t give me a value. The value is just nil.

Are your values ObjectValues?

Yes they are object values.3 33

What’s the current code that you have?

Can you show a picture of your explorer to see how it’s your carpet arranged?

I don’t get the error, but I don’t get a value.

It’s just 5 parts inside of a folder.

Can’t you reference the children of the MapsFolder directly instead of using another table?

I’m still not getting a value.

I tried the same thing on another part in the workspace, and the same code and it worked, but now it doesn’t want to go to serverstorage and get a part out of a folder.

The parts in server storage are gone when I play the game, could this be why? If so, where are they going?

Is this a server or local script?

Server script. Placed in server script service.