generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: AbsoluteSize being really weird

Previous Thread :: Next Thread 
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
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 is not online. 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
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
10 Jun 2014 03:16 PM
It's in a local script...
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Jun 2014 03:19 PM
Try adding a wait on the top
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
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 is not online. 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
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
10 Jun 2014 03:23 PM
Nope, it's a SceenGui.
Report Abuse
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
10 Jun 2014 03:25 PM
Um.. Don't use absolute size, and use the normal ways?
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
10 Jun 2014 03:26 PM
What other normal way is there to get a user's screen size.....
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Jun 2014 03:28 PM
I just tested it and it worked fine...
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
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
LordMatthewII is not online. LordMatthewII
Joined: 20 Aug 2011
Total Posts: 10873
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
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
10 Jun 2014 03:30 PM
what did the output say
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
10 Jun 2014 03:32 PM
Oh whoops the script I posted above doesn't say "GUI = script.Parent"
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
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
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
10 Jun 2014 03:37 PM
@cntkillme Hey what was the output you got?
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
10 Jun 2014 03:43 PM
Oh that's the problem... it's not updating every time it prints... why?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Jun 2014 03:44 PM
I got my window size at the time
Report Abuse
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
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 is not online. 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 is not online. 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
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
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 is not online. 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 is not online. 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
TheInnovative is not online. TheInnovative
Joined: 31 Dec 2008
Total Posts: 23486
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image