{"id":"pcoidev/betterscale","name":"betterscale","scope":"pcoidev","platform":"roblox","description":"Responsive UI scaling for Roblox. Set it up once and forget about it.","version":"2.1.0","latest":"2.1.0","versions":["1.0.0","2.0.0","2.0.1","2.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest's declared license (\"BloxLibs\") is not a recognized identifier."],"licenseVerified":true,"dependencies":{},"integrity":"fe5a11a0a87ac08d8cb813bc630a9f9c241b1013f736a6e120d261bc3d540820","likes":0,"downloads":0,"install":"forest install pcoidev/betterscale","url":"https://forest.dev/p/roblox/pcoidev/betterscale","files":"https://api.forest.dev/ai/package/roblox/pcoidev/betterscale/files","readme":"# BetterScale\r\n\r\n> A UI scaling solution for Roblox, without the headache.\r\n>\r\n> [![License](https://img.shields.io/badge/license-BloxLibs-blue)](LICENSE)\r\n> [![Wally](https://img.shields.io/badge/wally-pcoidev%2Fbetterscale-red)](https://wally.run/package/pcoidev/betterscale)\r\n> [![Pesde](https://img.shields.io/badge/pesde-bloxlibs%2Fbetterscale-orange)](https://pesde.dev/packages/bloxlibs/betterscale)\r\n\r\n---\r\n\r\nRoblox's built-in scaling tools have real gaps. `AutomaticSize` breaks layouts. `AutomaticCanvasSize` is unreliable. There's no built-in way to say \"I designed this for 1080p, scale it accordingly.\"\r\n\r\nBetterScale fixes this by managing a `UIScale` for you: it computes the ratio between the player's screen and your reference resolution, applies any overrides you've configured, and keeps it updated on resize.\r\n\r\n---\r\n\r\n## Setup\r\n\r\n```lua\r\nlocal uiScale = script.Parent.UIScale\r\n\r\n-- Resolution you designed at (default: 1280×720)\r\nuiScale:SetAttribute(\"Resolution\", Vector2.new(1920, 1080))\r\n\r\n-- Clamp so extreme screens don't break anything\r\nuiScale:SetAttribute(\"Range\", NumberRange.new(0.5, 2.0))\r\n\r\nlocal betterScale = BetterScale.new(uiScale)\r\nbetterScale:Track()\r\n```\r\n\r\nAll configuration is done through attributes on the `UIScale` instance. You can set them in the Properties panel in Studio — no code required.\r\n\r\n| Attribute       | Type            | Default     | Description                                         |\r\n| --------------- | --------------- | ----------- | --------------------------------------------------- |\r\n| `Resolution`    | `Vector2`       | `1280, 720` | Reference resolution you designed for.              |\r\n| `Ratio`         | `number`        | `1.0`       | Global multiplier on top of the computed scale.     |\r\n| `Range`         | `NumberRange`   | —           | Min/max clamp for the final scale value.            |\r\n| `Axis`          | `Enum`          | `XY`        | Scale by width (`X`), height (`Y`), or both (`XY`). |\r\n| `DisplayRatios` | `string` (JSON) | —           | Per-device ratio overrides.                         |\r\n\r\n---\r\n\r\n## Examples\r\n\r\n**Mobile needs bigger UI**\r\n\r\n```lua\r\nuiScale:SetAttribute(\"DisplayRatios\", '{\"Small\": 1.3}')\r\n```\r\n\r\n**Horizontal-only scaling**\r\n\r\n```lua\r\nuiScale:SetAttribute(\"Axis\", Enum.ScrollingDirection.X)\r\n```\r\n\r\n**Scale down slightly on large monitors**\r\n\r\n```lua\r\nuiScale:SetAttribute(\"DisplayRatios\", '{\"Large\": 0.9}')\r\n```\r\n\r\n---\r\n\r\n## How it works\r\n\r\nOn every resize, BetterScale computes `screenSize / resolution` on the configured axis, clamps it to `Range`, then multiplies by `Ratio` (with any matching `DisplayRatios` entry already folded in). The result goes straight to `UIScale.Scale`.\r\n\r\nThe initial update after `Track()` is deferred to the next `RenderStepped` frame so the UI has time to lay out first.\r\n\r\n---\r\n\r\n## API\r\n\r\n```lua\r\nlocal BetterScale = require(path.to.BetterScale)\r\nlocal uiScale = path.to.UIScale\r\n\r\n-- Configure scaling attributes\r\nuiScale:SetAttribute(\"Ratio\", 1.2)\r\nuiScale:SetAttribute(\"Range\", NumberRange.new(0.5, 2.0))\r\nuiScale:SetAttribute(\"Resolution\", Vector2.new(1920, 1080))\r\nuiScale:SetAttribute(\"Axis\", Enum.ScrollingDirection.X) -- X | Y | XY\r\nuiScale:SetAttribute(\"DisplayRatios\", '{\"Large\": 0.8, \"Small\": 1.3}')\r\n\r\n-- Quick usage: create + track in one call\r\nlocal cleanup = BetterScale.build(uiScale)\r\ncleanup()\r\n\r\n-- Or manual control\r\nlocal betterScale = BetterScale.new(uiScale)\r\nbetterScale:Track()\r\n\r\n-- Force a refresh manually\r\nbetterScale:Update()\r\n\r\n-- Type checking\r\nif BetterScale.is(betterScale) then\r\n\tprint(\"It's a BetterScale instance!\")\r\nend\r\n\r\n-- Later cleanup\r\nbetterScale:Destroy()\r\n```\r\n\r\n---\r\n\r\n## Projects using BetterScale\r\n\r\n| Project                | Link                                                                       |\r\n| ---------------------- | -------------------------------------------------------------------------- |\r\n| Squid Game Tower       | [View](https://www.roblox.com/games/103410145208388/Squid-Game-Tower)      |\r\n| Squid Game Troll Tower | [View](https://www.roblox.com/games/75139493550474/Squid-Game-Troll-Tower) |\r\n\r\nUsing BetterScale in your project? Contact [PcoiDev](https://pcoi.dev) to get listed.\r\n","readmeTruncated":false}