How would I make GUI hitbox accurate?

,

I have a image button. It works when I hover or press on a image. But even if my mouse is not on the the image, you can still press it. or hover it (changes the image). Reason why is because of the hitbox. How would I make it accurate?

example

1 Like

right now, there’s no way to check if your mouse is actually on the image or not (correct me if i’m wrong)

you could use a TextButton with UICorner as the hitbox to make it more accurate, but it won’t be perfect

1 Like

What i understand: the image is a an image of a text. And it can be interacted whenever you hover your mouse or whenever you click on it with your mouse. But not on the text itself.

Solution num. 1 : if the text is manually made (by you), you can set the canava size in the application you used to make the text, to the desired size. Then insert the image in the imageLabel or ImageButton and set the size of the imageLable or ImageButton to the size of the text.

Solution num. 2 : if the text is not made by you, then you can just crop it to the desired size. Then insert the image in the imageLabel or ImageButton and set the size of the imageLable or ImageButton to the size of the text.

3 Likes

So the text is an image and its working whenever you hover on it, but since there are still not visible part it works where it shouldn’t (visually shouldn’t)?

As I see image doesn’t fit the size of image frame (I don’t know how to call it properly, image label I guess) so I guess you could make it fit that size and then just make it smaller
Or as Bones said is to use UICorner

2 Likes