Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Unknown Error Found in Output in Map Radomization???

I have been working on a new game and I came across an error in the output. This error said "No method name passed in __namecall for Object," and I cannot fix it. I was attempting to create a variable for a random map in the "Maps" folder. Here is the line:

local rndmmap = game.ReplicatedStorage.Maps(math.random())

What did I do wrong and how do I fix it?

~tber8 / TTC

1 answer

✓ Accepted answer

You are indexing in the line of code wrongly. Firstly, you should get all the children of the maps folder. Then, use math.random() to select the random index of the list of maps to select it.

Here. Let me show you:

--Lines of other code...
local maps = game.ReplicatedStorage.Maps:GetChildren()
local rndmmap = maps[math.random(1, #maps)]
--...Continue

If you have any questions, please leave a comment below. Thanks!

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.