killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 08 Apr 2013 08:40 PM |
| Without using mouse? Since I need to get it in a MouseButton1Down event in a gui |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 08:45 PM |
-- this belongs in a LocalScript local gui -- assuming 'gui' is a GuiObject
gui.Size = UDim2.new(1, 0, 1, 0) print(gui.AbsoluteSize)
http://wiki.roblox.com/index.php/AbsoluteSize_(Property) |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 08:47 PM |
^^ Last i tried doing that AbsoluteSize always returned 0,0... |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 08:48 PM |
| AbsoluteSize always returns Vector2.new(0, 0) when not in the context of a LocalScript. |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
| |
|
|
| 08 Apr 2013 08:51 PM |
| actually, i have a feeling that the AbsoluteSize property is broken. i'm too lazy to test it, though. |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 08 Apr 2013 08:52 PM |
| Is there another way, then? |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 08:54 PM |
| gosh just test it first will you. lol |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 08 Apr 2013 08:59 PM |
| Haha just as sleepy as you are lazy :) |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 08 Apr 2013 09:10 PM |
There, I tested it. It works fine for localscript, but raises an error with a normal script:
Players.Player1.PlayerGui.ScreenGui.Frame.Script:2: attempt to concatenate field 'AbsoluteSize' (a userdata value) |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 09:12 PM |
actually that error shouldn't have anything to do with whether or not you're using a LocalScript or normal Script.
if you want to concatenate the AbsoluteSize value of a GuiObject to a string, you have to use the 'tostring' function. e.g.,
local gui -- some GuiObject
local s1 = "stuff" print(s1 .. tostring(gui.AbsoluteSize)) |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 08 Apr 2013 09:13 PM |
Just kidding. I actually managed to make an error in a two-lined script. It works in the regular script as well, for future reference. My error? print("Regular"..script.Parent.AbsoluteSize)
for localscript I omitted any string before the numbers, i just wrote regular to distinguish the two |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 09:18 PM |
lol, what are you guys doing?
local player = game.Players.LocalPlayer local SizeOfScreen = player.PlayerGui.ScreenGui.AbsoluteSize |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 08 Apr 2013 09:20 PM |
| b..bu.. but doom didn't say screengui had that property.. |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 09:21 PM |
| If you clicked on a ScreenGui object, you will see it's the 2nd property down... |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 08 Apr 2013 09:25 PM |
Mm.. Yeah while we're inventing properties here why don't you just go ahead and add a "Disc" enum to FormFactor for us, that'd be great.
(Lol look it's a joke ^^^ *wink*) |
|
|
| Report Abuse |
|
|
|
| 08 Apr 2013 09:27 PM |
| Wait, is this sarcasm? Or you srs. That will actually give you your screen res. |
|
|
| Report Abuse |
|
|