Randomizing an Instance

How would I randomly pick an Attachement?

Example image:
image

What I’m trying to do is set a part’s position to one of those attachments… So I would have to have a variable to the random attachment so that way I can modify it!

You can select a random children like this

local attachments = game.Workspace.Table.Glass:GetChildren() -- change this if needed

local randomAttachment = attachments[math.random(1, #attachments)]

Could you show your code so I can check and or if there are any errors

-- Get a list of all the children in a parent object
local parentObject = game.Workspace -- Replace with the name of your parent object
local children = parentObject:GetChildren()

-- Get a random number between 1 and the number of children
local randomIndex = math.random(1, #children)

-- Get the name of the randomly selected child
local randomChild = children[randomIndex]
local randomChildName = randomChild.Name

-- Print the name of the randomly selected child to the output console
print("Random object name: " .. randomChildName)

I am not sure why Nima’s solution “won’t” work.

You can try this as I specificed. Not sure if itll help