So, I'm needing a question answered.. and like, I want to know how to use math.random to get object names in a certain folder for a minigame script I'm doing. Couldn't figure it out. So, If anyone is kind enough please help me out - this is not a request though.
This is actually pretty simple. All you would have to do is get the children of the folder and then set up math.random to select an entry of the table :GetChildren returns. For my example, my folder will have 5 entries.
local gameFolder = game:GetService("ReplicatedStorage").gameFolder local games = gameFolder:GetChildren() local function chooseGame() local num = math.random(1,5) local chosenGame = games[num] return chosenGame.Name end local nextGame = chooseGame() print(nextGame)
This aint a asking website, Try looking it up please. Thank you! We cannot assist you as its against the Community Guildlines
Closed as Not Constructive by Ziffixture
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?