I tried to clone 3 random buttons but it still clone 1 button, no errors.
local Folder = script.Parent.ItemLists:GetChildren()
local Child = Folder[math.random(3, #Folder)]:Clone()
if Child:IsA("TextButton") then
Child.Parent = script.Parent.Items
end
local rand = Random.new()
local Folder = script.Parent.ItemLists:GetChildren()
for count = 1, 3 do
local Child = Folder[rand:NextInteger(3, #Folder)]:Clone()
if Child:IsA("TextButton") then
Child.Parent = script.Parent.Items
end
end
local Folder = script.Parent.ItemLists:GetChildren()
for i = 1, 3 do
local Child = Folder[math.random(3, #Folder)]:Clone()
if Child:IsA("TextButton") then
Child.Parent = script.Parent.Items
end
end
Use mine, using Random.new() and rand:NextInteger is unneeded. math.random() will suffice. (plus he literally just copied my code and edited it to use Random.new() and rand:NextInteger, editing his post after mine to make it look like I copied him…)
local Child = Folder[math.random(3, #Folder)]:Clone()
local old = Child
for count = 1,5 do
if old == Child then
Child = Folder[math.random(3, #Folder)]:Clone()
Child:Destroy()
else
Child = Folder[math.random(3, #Folder)]:Clone()
old = child
end
end
Using Random.new() and rand:NextInteger is actually needed, the reason why it’s working because I use Random.new() and rand:NextInteger
Instead of cloning the same button, it clones a different buttons
local random = folder[math.random(1, #folder)]:Clone()
for count = 1,5 do
local folder = game.ReplicatedStorage.Buttons:GetChildren()
local random = folder[math.random(1, #folder)]:Clone()
random.Parent = game.Players.mymomtookmyps5away.PlayerGui.ScreenGui.Frame
end