Not dissapearing when reached and key pressed

Hello! I’m making a simple rhythm game made in a GUI but when a note touches the hit arrow it dissapears the lower one.


function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.Q then
		print("Key Pressed")
		if script.Parent.OnScreen:FindFirstChild("Q") then
			if script.Parent.ArrowQ.Position.Y.Scale - script.Parent.OnScreen.Q.Position.Y.Scale then
				script.Parent.OnScreen.Q.Visible = false


If you have any solutions, Please reply. Thank you.

Hey, until where does it print?

When a key is pressed it prints it. But when something is found and its pressed, It prints Success too.

But it keeps printing success everytime i do it

(for a clear example: when image is hitten and key pressed, it’s supposed to dissapear

Uhm, I think I found your problem

			if script.Parent.ArrowQ.Position.Y.Scale - script.Parent.OnScreen.Q.Position.Y.Scale then

No demand here ^ you basically make it pass because it exists

What? But what i’m trying todo is when its near and under the black arrow, it was supposed to dissapear.

I don’t clearly understand what you mean.

-- here's how you're supposed to do it:
if (script.Parent.ArrowQ.Position.Y.Scale - script.Parent.OnScreen.Q.Position.Y.Scale).Magnitude < 5 then 
-- setting a certain distance it's supposed to disappear at
-- (basically telling the script: if the distance is 5 or less then make it disappear)

-- here's how you do it:
if script.Parent.ArrowQ.Position.Y.Scale - script.Parent.OnScreen.Q.Position.Y.Scale then
-- it shows "success" to everything because there's no set distance, you are basically doing something like this:
if 1-1 then

Understandable but… its all made in a GUI. The design, The code, everything.

Magnitude isn’t for 2D spaces like GUI.

Well, you can calculate the magnitude using AbsolutePosition

local UI = u1.AbsolutePosition
local UI2 = ui2.AbsolutePosition

local magnitude = (UI - UI2).Magnitude

I still need solutions… I want to make this rhythm game no matter what.