Get every UIScales that affect a Frame

Hello, I need to know how to get the list of every UIScale instances that affect a Frame.

for _, v in gui:GetDescendants() do
   if v:IsA("UIScale") then
      -- add them to a table or something
   end
end

It won’t work because Frame size can also be affected by UIScales parented to an ancestor of the Frame.

You could loop :GetFirstAnchestorOfClass() until you find all of them

for _, v in gui:GetDescendants() do
   if v:IsA("UIScale") then
      -- add them to a table or something
      if v.Parent:FindFirstChildOfClass("GuiObject", true) then
         -- other frames affected by the uiscale
      end
   end
end