So i want to make a store shelf, and when its refilled, shop items appear on it to the specific amount.
But before i do most of the code, i wanted to test a loop which will create items and put it on the shelf, and how i did it is that there’s 2 folders where the first one is the items that are invisible which the other folder has visible items. But i ran into a problem.
The problem is, it did work normally but, there weren’t exactly the amount of items i wanted to, i wanted 15, i tried putting print and it did print 15 times but there was only 12-14 items on the shelf. Sometimes though, it did get 15 items on the shelf.
I have looked for solutions around the devforum but couldn’t find exactly what i need.
Here’s the code.
local folder = workspace.NotInserted:GetChildren() for i = 1, 15 do print("inserted") local randomitem = folder[math.random(1, #folder)] randomitem.Parent = workspace.Inserted randomitem.Transparency = 0 randomitem.CanCollide = true end
Any help would be appreciated.