# How to prevent multiple callbacks from Tween onRepeat?

**URL:** <https://phaser.discourse.group/t/how-to-prevent-multiple-callbacks-from-tween-onrepeat/2253>\
**Category:** Phaser 3\
**Created:** [April 25, 2019, 2:01pm UTC](https://phaser.discourse.group/t/how-to-prevent-multiple-callbacks-from-tween-onrepeat/2253 "2019-04-25T14:01:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![flappie134](https://avatars.discourse-cdn.com/v4/letter/f/b782af/32.png) [@flappie134](https://phaser.discourse.group/u/flappie134)\
**Post date:** [April 25, 2019, 2:01pm UTC](https://phaser.discourse.group/t/how-to-prevent-multiple-callbacks-from-tween-onrepeat/2253/1 "2019-04-25T14:01:54Z")

</div>

Hello,

To keep it short, I want to scale a Container using a tween, this has to repeat 2 times and do a callback on each repeat. But having to scale the X and Y seperately fires the callback function twice, is there any way how to prevent this?

This is what I use:  
this.tweens.add({  
targets: this,  
scaleX: 1.2,  
scaleY: 1.2,  
hold: 500,  
duration: 500,  
ease: ‘Back.easeInOut’,  
repeat: 2,  
onRepeat: function() { console.log(‘hit’); },  
});

I also tried to set a temporary variable, set it to 1 and tween that variable and use an onUpdate: function { this.setScale(variable); }. It works, but it’s not really nice.

TLDR: How to scale an object using 1 property in a tween? or How to prevent multiple callbacks from multiple properties in a tween using the onRepeat callback?

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [April 25, 2019, 11:51pm UTC](https://phaser.discourse.group/t/how-to-prevent-multiple-callbacks-from-tween-onrepeat/2253/2 "2019-04-25T23:51:42Z")

</div>

Try using `loop` and `onLoop` instead.

---

<div class="post-metadata">

**Author:** ![flappie134](https://avatars.discourse-cdn.com/v4/letter/f/b782af/32.png) [@flappie134](https://phaser.discourse.group/u/flappie134)\
**Post date:** [April 26, 2019, 1:37pm UTC](https://phaser.discourse.group/t/how-to-prevent-multiple-callbacks-from-tween-onrepeat/2253/3 "2019-04-26T13:37:29Z")

</div>

That worked, thanks ^^
