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: TextBounds returning Vector2.new(0, 0)

Previous Thread :: Next Thread 
databrain is not online. databrain
Joined: 01 Jan 2013
Total Posts: 3342
23 Jul 2014 07:17 PM
Whenever I use TextBounds, in my local script, on my TextLabel, it returns Vector2.new(0, 0).

My script is local, and my TextLabel doesn't have TextScaled set to true. Any help on this?

Is TextBounds no longer supported? It doesn't seem to work in online mode.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Jul 2014 08:01 PM
Try waiting before getting it so it can render
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
23 Jul 2014 08:03 PM
Give it a parent.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
23 Jul 2014 08:06 PM
(I found this to be annoying. I am 90% certain its JUST being a descendant of a PlayerGui and being renderable, IDK if Visible affects it)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Jul 2014 08:06 PM
I don't think Visible affects it but when I used to use TextBounds, adding a wait usually fixed my problem of it returning (0, 0)
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
23 Jul 2014 08:08 PM
cntkillme: Don't wait, just check TextBounds after its parented and it will function correctly (IDK if it being offscreen affects it, I know being hidden by ClipsDescendants doesn't)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Jul 2014 08:10 PM
Wouldn't it already be parented if he just puts it in a GUI in StarterGui? Or are you assuming he is Instance.newing?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
23 Jul 2014 08:12 PM
I am assuming he is cloning it from somewhere, checking TextBounds, then parenting it last.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Jul 2014 08:16 PM
Probably.

Anyway the scenario I was talking about (or at least it was like this a year ago) was when I had a GUI in starterGUI but I couldn't instantly check textbounds (example being: print(script.Parent.Label.TextBounds)), but after adding a wait it seemed to work.

Maybe it was something wrong on my part.
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
23 Jul 2014 08:17 PM
Unless I do something wrong I never have that issue... Maybe they fixed it, but I don't remember a year ago or if I had a chat GUI a year ago (The largest use I use it for)
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
23 Jul 2014 08:19 PM
I think I was using a BillboardGUI actually, parent being StarterGui and adronee'd to some part in workspace.
Report Abuse
databrain is not online. databrain
Joined: 01 Jan 2013
Total Posts: 3342
23 Jul 2014 10:25 PM
So, it has to be parented?

That's a pain. I was meaning to make it not show the text until it calculated the positions based off the text length.

Allthough, if it's clipped by ClipDescendants, will it still work?
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
23 Jul 2014 10:26 PM
They wont notice, so why does it matter?
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