How to move a gui a certain pixels backward

Hi! So recently I made an arrow that points to another gui with this post

Now I want to tween the arrow so that it will move back and forth (relative to its own rotation), making it seem like an animated pointer. This is what I want:

Starting:
image

Ending:
image

If I have the starting, how do I use math to calculate the ending position? Thank you for reading this, and if you don’t understand my question but think you might be able to solve it with more information, feel free to ask me!

1 Like

I manage to solve this with some trigonometry :slight_smile:

local ViewPortSize = workspace.Camera.ViewportSize
local arrow = game.StarterGui.Tutorial.Arrow
arrow.Position = arrow.Position + UDim2.new(math.cos(math.rad(arrow.Rotation+90))/ ViewPortSize.X * 20,0,math.sin(math.rad(arrow.Rotation+90))/ ViewPortSize.Y * 20,0)
1 Like

So it’s solved?
Otherwise I could help you with making a tween script

1 Like

cant you just tween either of the guis to a specific point using sliding tweens

1 Like

Yes you can tween the “Position” property of the image.
Udim2.new()

1 Like

Yup, now I have a starting point and an ending point, but I still have a question. I want to make the arrow move faster (accelerate) towards the gui and then slow down as it gets further, kind of like the arrow bouncing on the gui. What tween easing style and direction should I use?

Edit: I know how to do this with TWO tweens, but how do I do it with just one?

1 Like

Very late response but here’s a link incase you are still looking for a solution.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.