How do I do a rhythmic styled GUI

So I have this GUI here and you can see that the red, green, and yellow frames are “zones” and the white GUI is a bar. The bar will move around and the player has to press E to time it right to be on the green zone. However, I am very confused on how TweenService works with GUIs. The bar’s kind of related to Robeats in a way since you have to time it right to hit it in the defined zone.

Here’s the picture: https://gyazo.com/aa7e398348b76a9ee0826cfbab2f5c5d

Here’s my script:

local TweenService = game:GetService("TweenService")

---------------------------------------------------------------

local Bar = script.Parent

local goal1 = {}
goal1.Position = UDim2.new(0.825,0,0.743,0)

local tweenInfo1 = TweenInfo.new(1.5)

local tween1 = TweenService:Create(Bar, tweenInfo1, goal1)

---------------------------------------------------------------

local goal2 = {}
goal2.Position = UDim2.new(0.163,0,0.743,0)

local tweenInfo2 = TweenInfo.new(1.5)

local tween2 = TweenService:Create(Bar, tweenInfo2, goal2)

---------------------------------------------------------------

if Bar.Position == UDim2.new(0.163,0,0.743,0) then
    tween1:Play()
end

if Bar.Position == UDim2.new(0.825,0,0.743,0) then
    tween2:Play()
end

Well, you will need to use UserInputService to detect if they are pressing the E key, and when they do press the key you could call the tween and use Tween:Cancel() to stop the tweening of the bar. Then what I would do is check if the position of the bar is in the bounds of the green frame, if not then penalty them.

You basically have the tweening part down, but you need to use the other elements I stated t properly execute your task.

Also in your image I don’t see a white bar.

I see. However, I don’t understand why it isn’t playing the tween. Should I do a while true loop?

updated link: https://gyazo.com/07fb8747041b389c90156c416f5f02d9

When you are doing those initial checks, you are checking the position of the bar. If your bar isn’t in that exact position then it will not play. I’d suggest to have the tween play on server start, then stop it when they press E.