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
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!