|
| 26 May 2010 06:07 PM |
| Like, if i have a GUI with a position of UDim2.new(0,250,0,250), how would i change it to UDim2.new(Numberhere,0,numberhere,0)? |
|
|
| Report Abuse |
|
|
|
| 26 May 2010 06:15 PM |
Its possible, lucky you, I made it yesterday, here, it'll check the script thats farther in the screen and then convert everything:
local right = 0 t = {} local starter = nil function get(where) for i, v in pairs(where:children()) do if v.className:find("Gui") and v.className~="StarterGui" and v.className ~= "ScreenGui" then table.insert(t, v) elseif v.className == "ScreenGui" then starter = v end get(v) end end get(game.StarterGui) local most = nil for i, v in pairs(t) do if v.Size.X.Offset+v.Position.X.Offset > right then right = v.Size.X.Offset+v.Position.X.Offset most = v:clone() end end for i, v in pairs(t) do for _, b in pairs({"Size", "Position"}) do v[b] = UDim2.new(v[b].X.Offset/right, 0, (v[b].Y.Offset/v[b].Y.Offset)*v[b].Y.Offset/most*starter.AbsoluteSize.x/starter.AbsoluteSize.y, 0) end end
|
|
|
| Report Abuse |
|
|
Raven5888
|
  |
| Joined: 12 Feb 2009 |
| Total Posts: 269 |
|
| |
|
|
| 26 May 2010 06:19 PM |
| Raven, thats not right, in-game screen doesn't have the exact same size in pixels as your screen's resolution, also, it was 250, not 200... |
|
|
| Report Abuse |
|
|
|
| 26 May 2010 06:50 PM |
| Whoa, where'd the variables v and b come from? |
|
|
| Report Abuse |
|
|
|
| 26 May 2010 07:20 PM |
I would assume
x.Offset/gui.AbsoluteSize.x
so if the offset was 200 and the screen was 800, you would get 0.25, which work. |
|
|
| Report Abuse |
|
|
|
| 26 May 2010 07:22 PM |
| Scipio knows about math. xP |
|
|
| Report Abuse |
|
|