I mean for example there is folder and the folder has things in it how do we randomize them?
Given that the folder
variable holds the Folder object, we can get its children in an array, pick a random index that is within the bounds of the array, and pick the child corresponding to that index:
local children = folder:GetChildren() local count = #children local random_index = math.random(1, count) -- random integer from 1 to count (inclusive) local random_child = children[random_index] -- random_child will now be one of the Folder's children, picked randomly
Good question! Here's an example of it! I use this all the time for things like randomly generated levels and stuff. Here's a video with a good example of it being used: https://youtu.be/_IbCnucSWjU
local Children = Folder:GetChildren() -- Gets the children of the folder local ChosenChild = Children[math.random(1,#Children)] -- Chooses a child from the folder print(ChosenChild.Name) -- Prints the name of the chosen child