when i minimize my rs studio window
expected size
when i minimize my rs studio window
expected size
There isn’t really a way to scale UIStroke
according to the windows resolution. You would need to use Scripts
to achieve that. Example:
local thicknessAt1080 = 2
local currentResolution = Camera.ViewportSize.Magnitude
local defaultResolution = Vector2.new(1920,1080).Magnitude
local newThickness = thicknessAt1080*currentResolution/defaultResolution
UIStroke.Thickness = newThickness -- Use a `math.round()` incase the thickness is uneven.
Yea since UIstrokes are pixel based it won’t scale depending on your resolution. Like cloud said you could make a local script that changes the UIstroke size depending on resolution
(higher resolutions = thicker UIstrokes
lower resolutions = thinner UIstrokes)
I would recommend using UIStrokeAdjuster for this. It’s easy to implement and scales all of your UIStrokes.
Hello AamTum,
I have the solution to your problem. A while ago, I created a LocalScript that ensures all UIStrokes in your game scale properly on any screen or when the player resizes their window. Try it out and let me know how it works for you!
The LocalScript should be placed inside StarterGui.
local cam = workspace:WaitForChild("Camera")
local starterGUI = script.Parent
local function AdjustUIStrokeThickness()
local viewportX = cam.ViewportSize.X -- Store the value to avoid recalculating it every iteration
for _, v in ipairs(starterGUI:GetDescendants()) do
if v:IsA("UIStroke") then
local parent = v.Parent
if parent then
if parent:IsA("Frame") or parent:IsA("ImageLabel") or parent:IsA("ImageButton") or parent:IsA("TextButton") then
v.Thickness = math.floor(viewportX / 400)
print(v.Thickness)
elseif parent:IsA("TextLabel") then
v.Thickness = math.floor(viewportX / 400)
end
end
end
end
end
-- Execute once
AdjustUIStrokeThickness()
-- Connect the function to adjust when the screen size changes
cam:GetPropertyChangedSignal("ViewportSize"):Connect(AdjustUIStrokeThickness)