Hello!
My name is Caelm, and I am going to teach you how you can scale
UIStrokes
in these three easy steps! By using this tutorial, you can turn unintentional largeUIStrokes
on smaller devices intoUIStrokes
that look exactly the same on different screens!
Step One
Open Explorer, and find
StarterGui
. Add aScreenGui
intoStarterGui
. You can name thisScreenGui
whatever you want, but I’m going to name mineUIStrokeScaler
.
Step Two
Inside your
ScreenGui
, you want to add aLocalScript
. You can name thisLocalScript
whatever you want as well, but I am going to name mineMain
.
Step Three
Open your
LocalScript
, and replace any code that has already been written with the following code:
-- Made by @ItsCaelmYt
for i, v in pairs(script.Parent.Parent:GetDescendants()) do
if v:IsA("UIStroke") then
local BASE_SIZE = 1200
local uiStroke = v
local initialStrokeThickness = uiStroke.Thickness
local camera = game:GetService("Workspace").CurrentCamera
local function updateStrokeThickness()
uiStroke.Thickness = initialStrokeThickness * camera.ViewportSize.X / BASE_SIZE
end
camera:GetPropertyChangedSignal("ViewportSize"):Connect(updateStrokeThickness)
updateStrokeThickness()
end
end
This code will get the current device’s screen resolution, and re-calculate the any
UIStroke
inStarterGui
, so that the UIStroke looks the same across all devices.
Additional Information
This will not scale
UIStrokes
when not playing your experience in Studio. However, if you play your experience in Studio while emulating your device, theUIStrokes
will scale.
Sometimes, the
UIStrokes
may not be perfect, but improved.
If you have any questions, reply below! Thanks!