How to get accurate MouseEnter/MouseLeave

I am trying to get when you hover on a card it moves up, however it’s incredibly difficult to select specific cards, and even while my mouse is over a card, it doesnt wanna go up.
ezgif.com-gif-maker (68)
I’ve tried using this module, however it can’t work as the cards are rotated to.

NewCard.MouseEnter:Connect(function()
		if SelectedCard then
			SelectedCard.ImageButton.Position = UDim2.fromScale(0.5, 0.5)
		end
		
		SelectedCard = NewCard
		
		NewCard.ImageButton.Position = UDim2.fromScale(0.5, 0.25)
	end)
	
	NewCard.MouseLeave:Connect(function()
		NewCard.ImageButton.Position = UDim2.fromScale(0.5, 0.5)
	end)
3 Likes

Have you tried setting the SelectedCard to nil when the mouse leaves? Does that affect anything?

It may be more efficient in this case to use math to determine which card the mouse is hovering over using the x-coordinate of the mouse.

2 Likes

You could use some simple math to determine where the mouse cursor is in relation to each card and pick from there. Just run constant checks on where the mouse is on the screen and its distance from every card. If only half the card is visible in the hand you can offset the point where the distance is being measured from to account for that.