how to make an object move from left to right and right to left using transition and how to pause them when a user clicks a button on the screen?

Hello , first sorry for my bad English.

This is my first post here. I try to make object move using transition and its work well. this my code

local function left() local function right() transition.to(musuh,{time=5000, x=musuh.x+200, onComplete=left , tag = "animationBlock"}) musuh.xScale=1 end transition.to(musuh,{time=5000, x=musuh.x-200, onComplete=right}) musuh.xScale=-1 end left()

my problems is,  when i click button pause is show corona runtime error.
 this my pause code

 -------------------------------------- ---- Pause Event local onButtonPauseEvent = function (event) if pausepressed == false then pausepressed = true physics.pause() animcoin:pause() jomblo:pause() musuh:pause() musuh2:pause() audio.pause() transition.pause("animationBlock") end

hope someone can help me here in my problem thanks a lot in advance.

I don’t see any issues with the transition.

Try removing some of the pause. It is somewhere in there.

transition.pause() should pause all active transitions.  Also you may need to remove runtime listeners and then re add them when you un-pause the game. 

Runtime:removeEventListener(“whatevertype”, whateverfunction)

I don’t see any issues with the transition.

Try removing some of the pause. It is somewhere in there.

transition.pause() should pause all active transitions.  Also you may need to remove runtime listeners and then re add them when you un-pause the game. 

Runtime:removeEventListener(“whatevertype”, whateverfunction)