Sometimes for a ui project, I would need to create a circle, but the circle isn’t always, circular.
So I either try with a low quality image.
One or the two
but since I figured it out, I want to share with yall
local uiElement = ... -- insert the path to the uielement
local uiCorner = Instance.new("UICorner")
local uiStroke = Instance.new("UIStroke");
local circleCenter = Instance.new("Frame");
local size = math.min(uiElement.AbsoluteSize.X, uiElement.AbsoluteSize.Y) / 2;
uiCorner.CornerRadius = UDim.new(15);
uiCorner.Parent = circleCenter;
uiStroke.Color = uiElement.BackgroundColor3;
uiStroke.Thickness = size - 1;
uiStroke.Parent = circleCenter;
circleCenter.Size = UDim2.fromOffset(1,1);
circleCenter.Position = UDim2.new(uiElement.Position.X.Scale, uiElement.Position.X.Offset + size, uiElement.Position.Y.Scale, uiElement.Position.Y.Offset + size)
circleCenter.Parent = uiElement.Parent;
circleCenter.Name = "CircleCenter";
circleCenter.BackgroundColor3 = uiStroke.Color;
uiElement.Parent = circleCenter;
uiElement.Position = UDim2.new(.5, .5);
uiElement.AnchorPoint = Vector2.one / 2
uiElement.Size = UDim2.fromScale(uiElement.Size.X.Scale + uiElement.Size.X.Offset, uiElement.Size.Y.Scale + uiElement.Size.Y.Offset)
uiElement.Transparency = 0.999;
uiCorner:Clone().Parent = uiElement;
Explaination or whatever:
The circumference of the circle is being rendered because of a uiStroke
That uistroke is inside a frame, which is rounded out because of a uiCorner (with a radius of liek 15, 0)
That frame is referred inside the pseudocode as “circleCenter”
The proportionality of that circleCenter is 1 : 1 because this function because (and to my knowledge) Roblox doesn’t have a feature to make ovals (at least not with basic GuiObjects).
(you can however create an pill shape by adjusting the size)
The radius is determined by the thickness of the uiStroke
The radius’ formula is shown in the pseudocode size - 1
size is the minimum of the axis’s of the AbsoluteSize of the uiElement
basically _> min(AbsoluteSize.X, AbsoluteSize.Y)
Subtracting it from 1 is because of the circleCenter’s size, which causes a little excess
And then the uiElement is stored inside that circleCenter, so it stays in position of the center of the circle (obvis)
The size is adjusted to scale (super ez)
Formula : UDim2.fromScale(OffsetX + ScaleX, OffsetY + u_understand)
Also the uiElement is added into the circle to at as a sensor, which is very useful for circle buttons
- useful
- neva gotta use it

