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: Help Wanted With a Close on Click Script

Previous Thread :: Next Thread 
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:17 PM
TextButton = script.Parent
TeleportGui = script.Parent.Parent

function onClicked(TextButton)
TeleportGui:remove()
end
script.Parent.MouseButton1Click:connect(onClicked)

When I click the button it doesn't remove, it just stayed there. I'm pretty sure i named the things correctly like "TextButton" etc. Would someone mind helping me?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Jul 2012 05:20 PM
The script should work, what is script.Parent.Parent?

† KMXD †
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:21 PM
Oops, lemme try deleting one parent and test it again.
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:22 PM
Nope still doesn't close
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Jul 2012 05:23 PM
Again what are you trying to remove, and what is its path (script.Parent, script.Parent.Parent, etc)?

† KMXD †
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
26 Jul 2012 05:24 PM
What does output say?
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:28 PM
I'm trying to remove the buttons, theres gonna be five buttons that say colors of animals and when you click one they remove themselves, the script.parent thing is to tell the computer that the script is in the gui model, not the button
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:30 PM
the output says this when i click it
MouseButton1Click is not a valid member of ScreenGui
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
26 Jul 2012 05:31 PM
Then you need to change your parents in the connection line.
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:33 PM
ok...Does that mean i need to but it in the TextButton?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Jul 2012 05:35 PM
What are you trying to remove the button itself, or the whole GUI? If the latter, how many parents is it until it reaches the GUI?

† KMXD †
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
26 Jul 2012 05:35 PM
The script? Yeah, then if it still doesn't work, show me the output again.
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:37 PM
I remember reading something this person posted and they said you need to use 2 ends, should i do that? on the second last line
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Jul 2012 05:37 PM
You only need one, for the function.

† KMXD †
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
26 Jul 2012 05:37 PM
No. The problem is not the amount of ends. The problem is exactly what the output says, which implies you either need to move the script or change the amount of parents.
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:38 PM
Im trying to remove the buttons then wait a certain amount of time and have the gui remove its self, like the whole gui
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:38 PM
im going to try to move the script to the button first
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Jul 2012 05:39 PM
...Yes the script needs to be in the button.

† KMXD †
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:41 PM
I moved the script and the button removes its self, when i add the four other buttons will it remove those as well?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Jul 2012 05:41 PM
Not unless you remove the whole GUI, or each individually.

† KMXD †
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:43 PM
i just want it to remove the buttons when you click it and have a white background for a certain period of time (which i may also need help on) and then have the whole gui remove its self
Report Abuse
filj is not online. filj
Joined: 24 Jul 2012
Total Posts: 72
26 Jul 2012 05:43 PM
It's a .MouseButton1Click script, NOT an onClick script.
Report Abuse
xXAmaterasuChanXx is not online. xXAmaterasuChanXx
Joined: 27 May 2011
Total Posts: 248
26 Jul 2012 05:44 PM
thanks for the info filj, ill remember that
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
26 Jul 2012 05:45 PM
What does that even mean?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
26 Jul 2012 05:46 PM
Try:

TextButton = script.Parent
function onClicked(TextButton)
for i, v in pairs(TextButton.Parent:GetChildren()) do
if v:IsA("TextButton") then
v:Destroy()
end
end
end
TextButton.MouseButton1Click:connect(onClicked)

† KMXD †
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