Well for that i made a simple formula that will let you scale them properly
I were in need of scalable Border/UIStroke/RichText and i decided to mess around with formulas and somehow managed to find a working method.
If you want short simple answer here is the formula:
local size = 50
local ViewPort = workspace.CurrentCamera.ViewportSize
math.min(ViewPort.X,ViewPort.Y)/ViewPort.Y *size
How does it work?
It works similar to UIAspectRatioConstraint
If X is bigger than Y then we round it to Y and devide by Y and multiply by size
I haven’t found any tutorial like mine with this answer; It were either some meh UI bloatware frameworks or such plus they all were doing this simple thing WRONG.
Funny how i figured out answer randomly
UPDATE:
Hower i just made another formula (with ChatGPT’s help this time) that works similarly and fully replicates UIAspectRatioConstraint
IF YOUR UISTROKE DOESNT USE UIAspectRatioConstraint THEN USE PREVIOUS FORMULA!
--Tips:
--1920/1080 = 1.7777777777777777 Ratio
--Ratio*Y = X
--X/Ratio = Y
local size = 50
local ViewPort = workspace.CurrentCamera.ViewportSize
local Ratio = Vector2.new(1080, 1080) -- `UIAspectRatioConstraint`'s Ratio would be 1
local Scaled = ((ViewPort.X/ViewPort.Y>Ratio.X/Ratio.Y and ViewPort.Y/Ratio.Y) or ViewPort.X / Ratio.X) *size
The problem with them is they simply don’t work as promised.
While they may do work but the point with Thickness is to shrink it down incase it covers your screen.
All they did is devide it by 2?(that stuipid) or do some weird/scary calculations
In other words complete misunderstanding on how screen resolutions work.
Hower im gonna be honest UIStrokeAdjuster - Properly scale your UIStrokes! did it probably the closest; yet still failed with some weird “Studio Resolution” constants.
You still haven’t provided any argument of them doing it right
Also my tutorial is right to the point with formula and not some annoying UI frameworks.
Dont want to look egoistical but please lets be honest here.
Wdym?? I usually use the last one, and it works perfectly on everything.
Kinda, but it works, thats what matters.
If you call these scary calculations, you havent seen scary calculations:
local studioAverage = (STUDIO_SCREEN_SIZE.X + STUDIO_SCREEN_SIZE.Y) / 2
local currentScreenAverage = (camera.ViewportSize.X + camera.ViewportSize.Y) / 2
local scaleFactor = currentScreenAverage / studioAverage
Wdym? go test out one of these, or if you’re to lazy, try the last one i linked. They work. And if it works, why reinvent the wheel? I dont think they are doing anything inherently wrong.
So are all of the ones I linked, you just have to do some digging, people still have to implement yours and make it work, unlike the last one i linked which literally has 2 solutions.
I kinda am?? do some digging before posting something.
Ok i made another method for scaling
Better than first one if you combine that with UIAspectRatioConstraint
For rest i would still use first method as since it is more simple and looks better on regular non UIAspectRatioConstraint scaled GUI