Attempt to get length of a Instance value

  1. What do you want to achieve? Keep it simple and clear!
    printing a random item in a folder

  2. What is the issue? Include screenshots / videos if possible!
    so I’m trying to print a random item from a folder but I’m getting a error on the printing line

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i tried doing different things to try to print a random item

This is how you would get a random item from a folder.

local children = dropper:GetChildren()
print(children[math.random(#children)])

This will error if there are no children. If that’s a concern, just check if #children>0

Thanks its working, I also realize I don’t need the for loop and I think you meant

local children = Droppers:GetChildren()

1 Like