Start typing to search packages!
illusion-scalemanager
By @illusionac
Roblox
Mirrored from WallyIllusion ScaleManager
A simple replacement for TextScaled that uses viewport width to control text size.
Overview
This module applies a UIScale to a TextLabel and updates it based on the camera’s viewport width.
The result is consistent, predictable scaling across different resolutions.
Using ISM, The Point of a TextLabel is uniquely to display text. It will have NO other purposes. The Original Wish was that we could set a proper TextSize (pixels) on a Text, and it would scale for any screen resolutions. A TextLabel is required to be placed inside a GuiObject container with some properties set. See Recommended Setup for more informations
Installation
Wally
Add IllusionScaleManager to your wally.toml:
[dependencies]
IllusionScaleManager = "illusionac/illusion-scalemanager@1.0.0"
Then run wally install and require it from a LocalScript/ClientScript:
local ScaleManager = require(ReplicatedStorage.Packages.IllusionScaleManager)
Manual / Rojo
- Place
src/IllusionScaleManager.luauin aModuleScript(e.g.ReplicatedStorage.Modules), or build it with Rojo usingdefault.project.json - Require it from a LocalScript/ClientScript
local ISM = require("@game/ReplicatedStorage/IllusionScaleManager")
Usage
local ScaleManager = require("@game/ReplicatedStorage/IllusionScaleManager")
local label = script.Parent:WaitForChild("TextLabel")
local scaledText = ScaleManager.new(label)
Example Usage (CollectionService)
An example client script is included in ExampleUsage/init.client.luau. It automatically initializes IllusionScaleManager on any TextLabel tagged with "SCALETEXT" via CollectionService, and cleans it up when the tag is removed.
- Place
ExampleUsage/init.client.luauin aScriptinsideReplicatedStoragewithRunContextset toClient - Place
src/IllusionScaleManager.luauas aModuleScriptchild of that script - Tag any
TextLabelwithSCALETEXT
Studio Plugin (AutoScaleText)
A Roblox Studio plugin is included in StudioPlugin/init.plugin.luau to preview live text scaling in Studio edit mode for TextLabels tagged with "SCALETEXT".
- Place
StudioPlugin/init.plugin.luauin aScript(inside a folder) withRunContextset toPlugin - Place
src/IllusionScaleManager.luauas aModuleScriptchild of that script - Right-click the folder and select Save / Export > Save as Local Plugin
- Use the ToggleScaling button in the Scale Text toolbar to enable or disable automatic scaling in Studio
Base Width
Default is 1920. use the BaseWidth property when calling the constructor to change it.
local scaledText = ScaleManager.new(label, 1366)
Scaling is calculated as:
scale = viewportWidth / baseWidth
Cleanup
Handled automatically when the TextLabel is destroyed.
Manual cleanup:
scaledText:Destroy()
-- or by TextLabel reference:
ScaleManager.Destroy(label)
Notes
- Client-only (uses
workspace.CurrentCamera) - If a
UIScalealready exists, it will be reused but not destroyed - This module should be the only thing modifying
UIScale.Scaleon the label
Recommended Setup For a TextLabel
IMPORTANT: Make sure the TextLabel is Inside: A Frame, A TextButton... Also (for TextButtons), you may remove the Text already set and put it to the Label. You may not use TextWrapped. Adjust TextSize as you wish, it will scale !
Size = UDim2.new(0.5, 0, 0.5, 0)
Position = UDim2.new(0.5, 0, 0.5, 0)
AnchorPoint = Vector2.new(0.5, 0.5)
TextScaled = false
BackgroundTransparency = 1
Package Details
Install command (Click to copy)
Version
1.0.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
