Random sound picker keeps getting number instead of the object in my folder

  1. What do you want to achieve? i want to fix my random picker, keeps getting number instead of object in a folder

  2. What is the issue?

would print normally if name is a number, if it’s name is like “Hit” or anything that isn’t a number it would bug

  1. What solutions have you tried so far? i tried searching for people with the same issue but failed
local GetSounds = Sounds:GetChildren()

local Randomized = math.random(1, #Sounds:GetChildren())
local PickedSound = Sounds[Randomized]
print(PickedSound)

wait wrong video NOT THAT VIDEO MY BAD (fixed)

qweasdqweasdqweasd

1 Like

You need the cycle through the Sounds by doing:

local GetSounds = Sounds:GetChildren()

local PickedSound = GetSounds[math.random(1, #GetSounds())]
print(PickedSound)
1 Like

it printed

4 is not a valid member of Folder “ReplicatedStorage.FX.Impacts.Fabric.Sounds”

(spoiler alert. it did not work)

never mind. i was an actual idiot. it worked i just typed it wrong. sorry

I was about to say that should work lol

lol

how do that blur thingy wqojasdknioqwji,edsfjnwefdsxckwem

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.