Hi, so I’m trying to make simple button animations where like, you click a button, and a circle object appears, slowly fading out while increasing in size. It also originally positions based on where you click on the button.
I’m struggling figuring out how to get the position for it to appear correctly though. Here’s the code I’m using to position the circle object:
local min_x, max_x = button.AbsolutePosition.X, button.AbsolutePosition.X + button.AbsoluteSize.X
local min_y, max_y = button.AbsolutePosition.Y, button.AbsolutePosition.Y + button.AbsoluteSize.Y
local x_value = math.clamp(mouse.X, min_x, max_x)
circle.Position = UDim2.new(0, 0, 0, 0) --What value to input for X scaled??
Basically, I’m trying to get it so it grabs the mouse’s X position in offset, compares it with the size of the button, then returns a number from 0-1 and I could use that as the Scaled X coordinate of the circle’s position. However, I’ve tried different logic but the circle always appears past, or close, to 1. The end goal would be to have it position anywhere from 0-1, so if I click on the far right side of the button, it appears at 0. Far left side, 1.
I can clarify more if needed, thanks!