How to make shake something

I want to shake a button updown while its being pressed. But this events are not working for me. any help will be kind.

A camera shake example is included with GD, probably you could use it for an object too.

I tryed that but when i use that it makes a effect of all button is moving.Well is there any way i can store current position?

Oh, I have just noticed my example have been replaced with a different one in GD.
If you’ve been using the new example with the platformer game, you can find my example on itch called camera-shake:

I believe it should work, what you need to do is get the position of the button you want to shake instead of the camera.
You can get the position by using the object.X() and object.Y() expressions.

There is also an other example called move-object-back-and-forth.
It is also one way to do it, only need to move it faster to make it look like shake.

Thanks a lot as usual it was the thing I needed.Thank you very much!:blush::blush::blush: