Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I pick a random child of game.Workspace?

How do I pick a random child?

Like I want this NPC to go to a random tree located in Workspace but how do I do this?

1 answer

✓ Accepted answer

math.random!

while wait(1) do
	local object = workspace:GetChildren()[math.random(1,#workspace:GetChildren())]
end

I don't think I have to explain, if you have any questions though, please ask

5 comments

0

omg I forgot about it! thank you!!!

0

np

0

Can you set this as best answer? :P

0

Thanks, I was looking for the same thing.

0

np

This discussion is preserved as it was. New answers, comments, and votes are closed.