local calculateScale = require(calculateScale)
local currentScale = calculateScale(myFrame)
local frameSize = frame.AbsoluteSize * currentScale
print(frameSize)
Last active
August 3, 2024 19:40
-
-
Save cxmeel/68a95187b137e2d6ae019de8b2485f12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--!strict | |
local function calculateScale(instance: Instance) | |
local scaleValues = {} | |
local lookInside = instance | |
while lookInside do | |
local uiScale = lookInside:FindFirstChildOfClass("UIScale") | |
if uiScale then | |
table.insert(scaleValues, uiScale.Scale) | |
end | |
lookInside = lookInside.Parent | |
end | |
local totalScale = table.remove(scaleValues) | |
while #scaleValues > 0 do | |
totalScale *= table.remove(scaleValues) | |
end | |
return totalScale or 1 | |
end | |
return calculateScale |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment