✓ Accepted answer
It depends on how many candies you want to make, but you will need to edit this. Im assuming that the candy is just a part so I shall try my best to fit your needs. You will need to have a model in lighting with the candies in it!
local Candies = game.Lighting.MODELFOLDERNAME:GetChildren()
function SpawnCandies(NumCandies)
for i = 1,NumCandies do
local Candy = Candies[math.random(1, #Candies)]:Clone()
Candy.Parent = game.Workspace
end
end
SpawnCandies(1)
If you don't understand then let me explain, Candies is a table of objects and when I used the variable Candy it chooses one of the random candies in the Candies variable. It's kinda hard to explain.
Don't forget to mark this as solved and as the correct answer!