Unfortunately, there isn’t an official way to make the UI Stroke fit on all devices, you could should make the icon in an external UI website and then export it to Roblox Studio as this would make the stroke fit on all screens, If you can’t though, then there is a hacky way using scripts to do it. Keep in mind this is a hacky way and could lead to some issues.
You can create a script that automatically rescales the UIStroke’s thickness based on the user’s screen size.
local Camera = workspace.CurrentCamera
local UIStroke = Path.to.UIStroke
local DEFAULT_VIEWPORT = Vector2.new(1920, 1080) -- Since I always have my screen emulated to 1920x1080
function minimize(vector2: Vector2)
return math.min(vector2.X, vector2.Y)
end
function CompareRatio(viewportSize: Vector2)
return minimize(Camera.ViewportSize) / minimize(viewportSize)
end
-- The size of the screen when you created or adjusted the UIStroke thickness.
-- Viewport attribute incase you adjusted the thickness using different screen size.
-- I recommend on just using the DEFAULT_VIEWPORT.
-- Just emulate your studio's screen to that size.
local Viewport = UIStroke:GetAttribute("Viewport") or DEFAULT_VIEWPORT
local OriginalThickness = UIStroke.Thickness
UIStroke.Thickness = OriginalThickness * CompareRatio(Viewport )
-- You can add a camera viewport change listener and update the new thickness.