Save X-Position of an instance to stick it to another

Hi there ^^

I’m currently making a hit bar, where the player can hit a ball perfectly. However I’m not sure how to manage sticking the HitLine to the HitBar in my case, since the HitLine is supposed to move left and right…

So I would need to stick the object to the x-position of the HitBar with the offset of x-pixels each frame. But I’m not the biggest coding head, so I’m not quite sure how to make that.

I’d be thankful for a tipp ^^


Does the moving part need to be separate for any reason?

I would have it all as one animation and check which frame it’s on when a key is pressed.
But it depends what other needs you have for it as there are a few different ways this could be done I imagine.

You can change The position of the hitline to hitbar center x and center y

Well yes and no, see, the hitline is supposed to move to the left and right, so putting it on the x and y will force it to stay in the middle