Getting a Single Unknown-named Child of a Folder

This seems like a pretty hacky way of doing this; is there a better method?

local object = folder:GetChildren()[1]

Yeah thats a good way but even better:

local num=math.random(1,#folder:GetChildren())
local object = folder:GetChildren()[num]

get children returns an array of objects that are in the instance you give it

is this hacky?

local array = {1, 2, 3}

print(array[1])

This is fine and not hacky imo, id rather have this than some “Instance:GetOnlyChild()”, thats just scuffed lol

2 Likes

Nah, to me it just looked strange.