Help for random spawn with Color Blocks

Hello everyone

I need help with Blocks spawning after they destroyed when touched. I’m trying to make a game similar to Bejewel. Ok so my problem is I need help when you destroy a falling block the game reloads with more random color blocks. That what I’m trying to do. But I seem stuck this is how I have it in this plug and play code:

Example

local pick = 0  
  
local function choose ()  
if pick == 0 then   
local blue = display.newRect(0,0,30,30)  
blue.x = 240  
blue.y = -160  
blue:setFillColor(0,0, 255)  
transition.to(blue, {time = 2000, x = 160, y = 150})  
local function change ()  
blue:removeSelf()  
blue = nil  
local function number ()  
pick = math.random(0, 2)  
print(pick)  
end  
timer.performWithDelay(1000, number, 1)  
end  
blue:addEventListener("touch", change)  
end  
if pick == 1 then  
local green = display.newRect(0,0,30,30)  
green.x = 240  
green.y = 0  
green:setFillColor(0,255, 0)  
transition.to(green, {time = 2000, x = 100, y = 200})  
end  
if pick == 2 then  
local red = display.newRect(0,0,30,30)  
red.x = 240  
red.y = 0  
red:setFillColor(255,0, 0)  
transition.to(red, {time = 2000, x = 100, y = 250})  
end  
end  
timer.performWithDelay(1000, choose, 1)  

I’m trying to randomize the color blocks after they are destroyed

Thanks [import]uid: 17058 topic_id: 29881 reply_id: 329881[/import]

I would really like some help please [import]uid: 17058 topic_id: 29881 reply_id: 119972[/import]

I would really like some help please [import]uid: 17058 topic_id: 29881 reply_id: 119972[/import]