Use More Than One Timer At The Same Time

hello developers i want to make something like that using two timers
timer.performWithDelay(2000,
function()
timer.performWithDelay(1000,
function ()
local position = ObjectsList[j].position
obj= movieclip.newAnim(ObjectsList[j].frames)
obj:play()
obj.x =position[i].x
obj.y=position[i].y
i = i +1
end
,ObjectsList[j].number);
j = j + 1
end
,#ObjectsList)
thats not working with me please help :slight_smile:
first timer to spawn objects with different location the second to spawn more than one object at the same location

i want to simultaneously spawn objects in different location

thanks in advance
[import]uid: 74537 topic_id: 15348 reply_id: 315348[/import]

try putting i = 1 after j = j + 1. [import]uid: 71210 topic_id: 15348 reply_id: 56638[/import]

you may also have another problem…
when you run the internal function for the first time you will expect the value of j to be 1 but value of j is incremented on the line just after the inside timer.
see the following example

[lua]local i
local j = 1
timer.performWithDelay(2600,
function()
i = 1;
timer.performWithDelay(400,
function ()
print(“i=”…i…“j=”…j) ;
i = i + 1
end,5);
j = j + 1
end ,5)[/lua] [import]uid: 71210 topic_id: 15348 reply_id: 56640[/import]

thank you @renvis :slight_smile: thats solve my problem :slight_smile: [import]uid: 74537 topic_id: 15348 reply_id: 56657[/import]