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

Choose random from this folder???

while true do
local repstorage = game:GetService("ReplicatedStorage")
		wait(10) -- just the testing num
local part = repstorage.DFStuff.MaguMagu:Clone()-- Change "Part" to the part name.
part.Parent = game.Workspace
print('fruit spawned') -- will be removed
	end

1 answer

✓ Accepted answer

Here is one way to randomly choose an item:

local DFChildren = repstorage.DFStuff:GetChildren() -- Returns a table
local random = DFChildren[math.random(1, #DFChildren)]

Line 2 uses math.random() to iterate through the table and grab a random index.

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