Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 05:36 PM |
This is my first time working with a GUI, and I'm having a large amount of problems... How I have it set up: StarterGui GuiMain -- A ScreenGui Frame script -- Controling the positioning, inside of Frame TextButton -- Inside of the Frame LocalScript -- Inside TextButton, tried with normal script as well.
Here is the script, I copied it from the wiki, but changed element to script.Parent:
function onClick() print("Clicked") end script.Parent.MouseButton1Click:connect(onClick)
This does nothing and does not give output. Can I have some help please? |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2012 05:37 PM |
You have to go to Test>Play Solo to test it.
-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]- |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2012 05:37 PM |
| You made it so when the parent of the script is clicked it prints "Clicked". The parent of the script is GuiMain. This has to be in a TextButton. |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 05:42 PM |
Sorry, I stated that wrong. The LocalScript, which contains the code I mentioned, is inside of the TextButton.
And I tried play solo, and it still didn't give me output. |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
| |
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
| |
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2012 07:44 PM |
Local scripts don't do prints. For test, do game.Workspace.Message.Text = "KK!" |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2012 07:45 PM |
| @cnt, LocalScripts do print in Solo. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2012 07:48 PM |
Ohh yea, put the scirpt in the button btw or change the connector to:
script.Parent["ButtonName"].MouseButton1Down |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2012 08:00 PM |
I know why because you have to choose what to click for instance: function onClick() script.Parent.Parent.Text = " Hi " print("Clicked") end script.Parent.MouseButton1Down:connect(onClick) |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 08:14 PM |
| If I don't want to change the text, why would that be needed to make the script run? And yes, it is in the TextButton. Help please? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2012 08:18 PM |
script.Parent.MouseButton1Down:connect(function() print("It should work") end) |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 08:48 PM |
| No, actually it didn't. Have I got it set up wrong? The LocalScript (I tried with a normal script as well) is inside a TextButton, which is inside a Frame, which is inside a ScreenGui. Help please? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2012 08:49 PM |
srsly? is it exactly like this:
Player -PlayerGui --ScreenGui ---Frame ----Button -----Script |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 09:12 PM |
| Yes. Do you want me to make a model as an example? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 09:19 PM |
| Alright, I made it. It's messing up though.. The three extra scripts in Workspace aren't supposed to be there, and nor are the Frame and TextButton parented to Workspace.. |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 09:20 PM |
| And GuiMain is supposed to be in StarterGui, not Workspace.. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 16 Oct 2012 09:22 PM |
| It clones to PLAYER when you play the game. |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 16 Oct 2012 09:23 PM |
How does that affect
script.Parent.MouseButton1Down:connect(function() print("It should work") end)
? |
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
| |
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Oct 2012 10:12 PM |
| First, ill do nothing cuz i think you already found out with so meny posts, so BUMP! |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 16 Oct 2012 10:12 PM |
| First, ill do nothing cuz i think you already found out with so meny posts, so BUMP! |
|
|
| Report Abuse |
|
|
|
| 16 Oct 2012 10:12 PM |
| @king, learn some grammar and sense. |
|
|
| Report Abuse |
|
|