I'm trying to find a certain block out of 3 blocks, using math.random
local FolderForParts = game.Workspace.Folder local PartNumber = math.random(1,3) -- 3 Blocks in folder local Part = --Finds the part
The part names (just keeping it simple): Part1 Part2 Part3
You need to get the number of the part
local FolderForParts = game.Workspace.Folder local PartNumber = math.random(1,#FolderForParts:GetChildren()) local Part = FolderForParts:WaitForChild("Part".. tostring(partNumber))
This script transforms the selected number into a string and gets the selected part in the folder. P.S: With this script you can put as many parts as you want as long as they are numbered
I think this is what you want.
local FolderForParts = game.Workspace.Folder:GetChildren() -- make a table of parts local PartNumber = math.random(1,#FolderForParts) -- 1 through length of table local Part = FolderForParts[PartNumber] -- reference chosen part print(Part.Name)