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
MapChildren:GetChildren()[math.random(#MapChildren:GetChildren())]
Although I think you meant to use it on MapsFolder
1 Like
Are there even any children in the maps themselves? Again, did you mean to do just
MapsFolder:GetChildren()[math.random(#MapsFolder:GetChildren())]
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.
Sci_Punk
(Sci_Punk)
May 24, 2021, 4:23pm
#6
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?
Sci_Punk
(Sci_Punk)
May 24, 2021, 4:34pm
#12
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?
Sci_Punk
(Sci_Punk)
May 24, 2021, 5:02pm
#19
Is this a server or local script?
Server script. Placed in server script service.