Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- mobile screen fixer
- local VirtualRes = Vector2.new(1280, 720)
- local Cam = workspace.CurrentCamera
- local Core = game:GetService("CoreGui")
- local LP = game:GetService("Players").LocalPlayer
- local PGui = LP:WaitForChild("PlayerGui")
- local function FixRes(gui)
- if not gui:IsA("ScreenGui") then return end
- if gui.Name == "RobloxGui" or gui.Name == "TouchGui" then return end
- local scale = math.min(Cam.ViewportSize.X / VirtualRes.X, Cam.ViewportSize.Y / VirtualRes.Y)
- local uiscale = gui:FindFirstChildOfClass("UIScale") or Instance.new("UIScale", gui)
- uiscale.Scale = scale
- end
- local function Watch(parent)
- for _, v in ipairs(parent:GetChildren()) do
- pcall(FixRes, v)
- end
- parent.ChildAdded:Connect(function(v)
- task.wait()
- pcall(FixRes, v)
- end)
- end
- Watch(Core)
- Watch(PGui)
- Cam:GetPropertyChangedSignal("ViewportSize"):Connect(function()
- Watch(Core)
- Watch(PGui)
- end)
Advertisement
Add Comment
Please, Sign In to add comment