mofolad
(mofolad)
February 18, 2025, 11:57pm
#1
Hi. I am having trouble with ui buttons.
My border (the white bit) is an image label and the red bit is the imagebutton. How do I crop out the bits circled in blue so that the button can only be clicked in the area inside the white border?
Thanks.
Hazelfluff
(Hazelfluff)
February 19, 2025, 1:53am
#2
m what if you made the button smaller?
(also the edge seems so small in this case… would it really be that much of a difference?)
Here are some other solutiosns
Make a container encapsulating the 3 buttons, such as a big TextButton.
Get the relative mouse position (x, y).
Assume f(x) is the linear equation that divides “Ranks” from “Gamepasses”/“Items”, check that y < f(x) (remember the smaller y is the higher the cursor is), if so stop there, the user is clicking “Ranks”.
Otherwise, assuming g(x) is the linear equation that divides “Gamepasses” from “Items”, check that y < g(x), if so the user is clicking “Gamepasses”, otherwise “Items”.
Im not sure if you found a solution by now, but I have one but it may be somewhat unoptimized.
for any shape you can use multiple transparent frames parented inside each other that have the ‘ClipDescendants’ property enabled. The last descendant would then be the button, frame, or whatever UI object you need in it’s normal form.
I haven’t tested this out yet so this solution might not work.
I created a workaround that is relatively complex, but it works:
Create multiple buttons (with different sizes and rotations) to cover the entire area of a lot:
[image]
Group all these buttons inside a folder correspondent of that lot:
[image]
Create one transparent PNG image for each button, with the exact lot contour (and with the same original map size):
[image]
Inside a RenderStep, detect the mouse position and the Gui Objects under mouse:
Mouse2.Position = UserInputService:GetMo…
You can’t make UI with irregular selection, squares are the only way.
Instead of using UI with buttons, you could instead have a system which detects what part the mouse is hovering over, and when you click on a part, which lets you do the things you want done, darkening when hovering and clicking to select territory.
I’m assuming you already have it setup in a 3d space from the screenshot you’ve shown, so this would be easier to do. If its MeshParts, just make sure the collision type is Preci…