|
| 10 Jun 2014 03:15 PM |
I'm testing stuff with AbsoluteSize and uh, wat.
------------------------------------------------------ AbsoluteSize = script.Parent.Parent.Parent.AbsoluteSize AbsoluteLength = AbsoluteSize.X AbsoluteHeight = AbsoluteSize.Y
GUI.Changed:connect(function(Property) print("Height of: " .. AbsoluteHeight) print("Length of: " .. AbsoluteLength) end) ------------------------------------------------------
OUTPUT: Height of: 0 Length of: 0 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jun 2014 03:15 PM |
| You have to do it client-side (local script) |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jun 2014 03:19 PM |
| Try adding a wait on the top |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:21 PM |
Ok, but I should also add I tested that in Play Solo
When I tested online in a legit server, the console said a height of 600 and length of 800
which 1, isn't true, and two, wouldn't change even when I resized the window |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jun 2014 03:22 PM |
| Make sure you aren't getting the size of a frame |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Jun 2014 03:25 PM |
| Um.. Don't use absolute size, and use the normal ways? |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:26 PM |
| What other normal way is there to get a user's screen size..... |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jun 2014 03:28 PM |
| I just tested it and it worked fine... |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:30 PM |
| If you want to make sure, the script is in an ImageLabel, in a Frame, in a ScreenGui (The one were playing with here) and that is inside PlayerGui (Or StarterGui when you are in edit mode) |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:30 PM |
| UDim2.new(1,0,1,0) -- Covers up everything, but I still don't know what you are looking for Exactly. |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Jun 2014 03:32 PM |
| Oh whoops the script I posted above doesn't say "GUI = script.Parent" |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:32 PM |
@Lord
Nah I'm not changing stuff, I'm checking for what the User's Screen size is. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:37 PM |
| @cntkillme Hey what was the output you got? |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:43 PM |
| Oh that's the problem... it's not updating every time it prints... why? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jun 2014 03:44 PM |
| I got my window size at the time |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:48 PM |
Well for me it just says 600 and 800 (which is WRONG, but that is what roblox sets it to open at when the window FIRST opens)
But when I resize the window, it doesn't update |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Jun 2014 03:50 PM |
[localscript] game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(chr) sizegui = Instance.new("ScreenGui", plr.PlayerGui) sizeframe = Instance.new("Frame", sizegui) sizeframe.BackgroundTransparency = 1 sizeframe.Size = UDim2.new(1,0,1,0) sizeframe.Changed:connect(function(frm) print("X dim is ".. sizeframe.AbsoluteSize.X .." Y dim is ".. sizeframe.AbsoluteSize.Y) end) [/localscript] |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jun 2014 03:51 PM |
No powertool.
OP, It's possible the changed event doesn't catch it. Try using a loop |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:54 PM |
I tried seeing if the property that is changed is Absolute size
It isn't...
but then if I use a loop like while true do it will add some more lag wouldn't it? I mean that means it would constantly be checking |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 10 Jun 2014 03:54 PM |
| If a child changes at all it calls the function. Then I just print the absolutesize. I've been fed the counterargument that things like that can slip between repetitions of the loop. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 10 Jun 2014 03:55 PM |
| Not really, but it might be the only way is the changed event doesn't pick up those changes. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:57 PM |
Well here is the FULL function that I plan on using, but it doesn't do anything because the Property is ~= AbsoluteSize
AbsoluteSize = script.Parent.Parent.Parent.AbsoluteSize AbsoluteLength = AbsoluteSize.X AbsoluteHeight = AbsoluteSize.Y GUI = script.Parent GUIOLength = GUI.Size.X.Offset GUIOHeight = GUI.Size.Y.Offset
GUI.Changed:connect(function(Property) wait() if Property == AbsoluteSize then if AbsoluteLength > 1920 and AbsoluteHeight > 1080 then GUIOHeight = AbsoluteHeight GUIOLength = (1920*AbsoluteHeight)/1080 print(GUIOHeight) print(GUIOLength) end print("Height of: " .. AbsoluteHeight) print("Length of: " .. AbsoluteLength) end end) |
|
|
| Report Abuse |
|
|