I’m creating a system where I need to pick a random sound ID from an array, but I’m not sure how I could achieve this.
Please note, I’m not asking for a fully working script, I just need an idea on what I can use to accomplish the above.
I’m creating a system where I need to pick a random sound ID from an array, but I’m not sure how I could achieve this.
Please note, I’m not asking for a fully working script, I just need an idea on what I can use to accomplish the above.
Pick a random number from 1 to the length of the array then use it.
local Array = {
1928576195,
1257891578915,
59875,
091590612
}
local RandomElement = Array[math.random(1, #Array)]
Agh! I should have thought of that! Thanks so much for your help. I’ll mark your reply as the solution so people can use your kind assistance if ever needed.