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 » Scripters
Home Search
 

Re: Getting Boolean From Property?

Previous Thread :: Next Thread 
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:22 PM
How do I get the boolean value from a property?

I'm trying to check if something is visible or not (GuiObject). I know I can use an 'if statement', but I'm trying to avoid that.

When I run the following command:
print(Frame.Visible)
The output in 'nil'. How do I get the Frame's 'Visible' property without 'if statements'?

Thanks.


~MightyDantheman~
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
07 Feb 2017 04:23 PM
just reference the property? it should work fine...


Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:23 PM
What do you mean by that? Example please.


~MightyDantheman~
Report Abuse
Majarite is not online. Majarite
Joined: 14 Jan 2017
Total Posts: 394
07 Feb 2017 04:24 PM
You can access the property like normal?

What's wrong with an if statement?


Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
07 Feb 2017 04:24 PM
post the whole script where trying to access Frame.Visible returns nil


Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:26 PM
No need. Just assume 'Frame' is a valid variable of which it's ClassName is also 'Frame'.

As for 'if statements', it takes up unnecessary space for what I'm doing.


~MightyDantheman~
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
07 Feb 2017 04:28 PM
you're clearly doing something incorrectly, it would either return true or false


Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Feb 2017 04:29 PM
$100 that Frame is a table
Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:31 PM
I'm 100% sure I'm not doing anything wrong. Printing a boolean results in a nil value by default. This is why something like NumberValue.Value requires '.Value' at the end. Property values don't have this, though.


~MightyDantheman~
Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:32 PM
It's not a table.


~MightyDantheman~
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
07 Feb 2017 04:32 PM
"This is why something like NumberValue.Value requires '.Value' at the end."

that's entirely incorrect. NumberValue is the object itself and Value is the property

post your script so cnt can get his 100


Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:35 PM
I'm trying to print the property's value. There's no reason to post my script. It's as simple as pathing to the Frame's 'Visible' property. If you print a NumberValue alone, you'll receive its name, not it's value. I'm talking about a property of a non-Value object.


~MightyDantheman~
Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:36 PM
In fact, why don't you try to print a frame's visible property? Tell me what you get (without using if statements).


~MightyDantheman~
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
07 Feb 2017 04:36 PM
I'm done replying here until you post the code


Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:38 PM
Like I said, you try to print a frame's visible property and tell me what you get. I'm not a newbie for god's sake.


~MightyDantheman~
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
07 Feb 2017 04:40 PM
print(player.PlayerGui.ScreenGui.Frame.Visible)


Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:41 PM
Btw, why would it matter even if it was in a table?


~MightyDantheman~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Feb 2017 04:42 PM
> scripter does something wrong
> refuses to blame it on himself
> says some stupid things

bro.... this aint originality
Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:46 PM
Turns out that I didn't even have a Frame inside the ScreenGui. Don't ask how I messed that up.

cnt, if you're not going to help, leave.


~MightyDantheman~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Feb 2017 04:49 PM
No, the problem was that you were trying to index "Visible" of a table.
No matter where the GuiObject is, fetching the Visible property will only ever return true or false.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
07 Feb 2017 04:49 PM
just a pointer next time you're trying to get help: don't be stubborn and actually post the code so you don't make a 20-reply thread of people trying to troubleshoot over an error as simple as this


Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:52 PM
cnt, I was writing something that checks for the contents of a list of guis. The one I was selecting was an empty test ScreenGui.

You still haven't answered my question, though. Why would it matter if it were in a table?


~MightyDantheman~
Report Abuse
MightyDantheman is not online. MightyDantheman
Joined: 06 May 2011
Total Posts: 5108
07 Feb 2017 04:53 PM
@Unsubtleties

I've been here many years. I post my code when I'm not confident in what I'm doing.


~MightyDantheman~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Feb 2017 04:54 PM
I'm saying if `Frame` is a table then chances are there is no value mapped to by a key named `Visible`.

It's impossible to get nil when you're indexing a boolean property. If the property doesn't exist: you get the child or and error. If it does exist, you're guaranteed the type it holds. In the case of `Visible` it would always be either true or false, never nil.
Report Abuse
Unsubtleties is not online. Unsubtleties
Joined: 28 Nov 2016
Total Posts: 9203
07 Feb 2017 04:54 PM
"I post my code when I'm not confident in what I'm doing."
stop being confident


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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