How to make UIStroke the same size on all screens?
Here is a comparison of how it looks on PC and mobile:
How to make UIStroke the same size on all screens?
Here is a comparison of how it looks on PC and mobile:
This should be possible natively but it isn’t. Why isn’t it? I don’t know. Instead, you have to do some math:
local textLabel = script.Parent
local uiStroke = textLabel:WaitForChild('UIStroke')
local absoluteSizeY = 61 -- this should be the TextLabel's AbsoluteSize.Y. Write this manually as it'll vary between devices
local fixedUIStrokeSize = uiStroke.Thickness -- this will be the UIStroke's Thickness property (obviously)
local toAddPerPixel = fixedUIStrokeSize / absoluteSizeY -- this will be how much thickness we add per pixel, equates to just under 0.05 in this circumstance bc my UIStroke's thickness is 3
local function fixSize()
uiStroke.Thickness = textLabel.AbsoluteSize.Y * toAddPerPixel
end
fixSize()
textLabel:GetPropertyChangedSignal('AbsoluteSize'):Connect(fixSize) -- just in case the label's size changes, this could be from resizing the window or manually changing its size