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: Gui button

Previous Thread :: Next Thread 
iLiminate is not online. iLiminate
Joined: 26 Feb 2012
Total Posts: 388
30 Oct 2013 09:37 AM
script.Parent.MouseButton1Down:connect(function()
script.Parent.Parent.Visible = false
end)

This is my script for my gui to close, but when I click the button it will not close, any help?
Report Abuse
adark is not online. adark
Joined: 13 Jan 2008
Total Posts: 6412
30 Oct 2013 09:39 AM
Any output errors?
Report Abuse
littleAU999 is not online. littleAU999
Joined: 15 Jan 2011
Total Posts: 1375
30 Oct 2013 09:48 AM
That script should work if:

- The script is inside the button
- The button's parent has a property called 'Visible'
- The script is not disabled

;P
Report Abuse
iLiminate is not online. iLiminate
Joined: 26 Feb 2012
Total Posts: 388
30 Oct 2013 10:09 AM
No outpt, its not side a button, and it has visible, and its not working.
=(
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 10:11 AM
function onClicked(m)
script.Parent.Parent.Visible = false
end

script.Parent.MouseButton1Down:connect(onClicked)
Report Abuse
adark is not online. adark
Joined: 13 Jan 2008
Total Posts: 6412
30 Oct 2013 10:16 AM
@Crni; Anonymous functions. look 'me up.

@OP; Are you sure you want to set the object's Parent's Visible to false, and not the object itself's?
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 10:22 AM
Look you up? What are you talking about?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Oct 2013 10:43 AM
I think he meant "look 'em up", not "look 'me up"... an anonymous function is basically this:

blah.blah:connect(function()
blah
end)

Instead of:

function blah()
blah
end

blah.blah:conncet(blah)

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
adark is not online. adark
Joined: 13 Jan 2008
Total Posts: 6412
30 Oct 2013 10:49 AM
@Nelson, exactly. AutoCorrect is a bob.
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 10:51 AM
Ah.. I do not really like anonymous functions. Are they used for something that cannot be achieved without an it?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Oct 2013 10:51 AM
@adark
That is exactly why I refuse to post on my phone... I just use the school computers :P

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Oct 2013 10:52 AM
@CrniOrao
Nope, they are simply easier to use, and eventually you'll find them impossible NOT to use (I used to hate them, now I love them).

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 10:54 AM
So, this should work, as an example?


Script.Parent.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") then
name = hit.Parent.Name
Players.name:Kick()
end
end)
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Oct 2013 10:56 AM
The use of the function would work, but the function itself would not... you indexed wrong, and capitalized "Script" ;P

script.Parent.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") then
name = hit.Parent.Name
Players[name]:Kick()
end
end)

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Oct 2013 10:56 AM
@Myself
*but the script itself would not... oops

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
adark is not online. adark
Joined: 13 Jan 2008
Total Posts: 6412
30 Oct 2013 10:57 AM
They're never exactly impossible not to use, since wherever you use one you can just use a variable that points to a function, but yeah.

Anonymous functions are typically used when you connect a function to one and only one event. In this case, it's a line less code and a variable name unused, saving some time typing and a tiny bit of RAM.


Now I'm curious, though, why don't you like them?
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 11:00 AM
Ah, probably capitalized "Script" in a hurry.
Thanks for the info. It might be less text, yet a bit more complex to me since I am not used to it at the moment. I will try to use it more often!

Do you mind if I send you any personal messages if I will need an assistance in any other kind of explanation of how stuff works? In future times.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Oct 2013 11:00 AM
@adark
That was a figure of speech :3

Anywho, I personally didn't like them because I didn't want to change, as I'd been using the other way for quite some time. It's the same way some people don't like it when the theme changes... some people just don't like change. But @CrniOrao might have a different reason.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 11:01 AM
@adark
They just felt too complex. x)
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
30 Oct 2013 11:02 AM
@CrniOrao #latepost
Just send me a message and (as long as I'm not busy), I'd love to help. However, you should search it up on the Wiki first, as it contains more in-depth examples.

Yes, I just used a hashtag on Roblox. Deal with it.
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 11:05 AM
Alright. I usually do check Wiki before posting on Forums / sending messages.
Don't worry, I do not really need a lot of help since I have no ideas and my imagination is a failure, for now... :P
Report Abuse
iLiminate is not online. iLiminate
Joined: 26 Feb 2012
Total Posts: 388
30 Oct 2013 11:12 AM
Sorry about late post, I've been trying a bunch of different things, and none of them seem to work. You can view my place here:
http://www.roblox.com/Legend-of-the-Lost-Staff-RPG-EARLY-BETA-place?id=75797010
Im trying to make a button that exits out of the gui, I am having terrible luck.
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 11:13 AM
But the place entry is 25R$, I myself do not have that value. :)
Report Abuse
iLiminate is not online. iLiminate
Joined: 26 Feb 2012
Total Posts: 388
30 Oct 2013 11:14 AM
Erp my bad, fixed
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
30 Oct 2013 11:15 AM
Sorry, I automatically clicked on your profile... This is completely different x)
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