DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 06:24 PM |
| I would like someone to make me a script or direct me to a wiki page to where, when you type something in the TextBox it shows up on a Surface GUI and the max characters that shows up on the Surface GIU is 3. Can anyone help me? |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 06:32 PM |
What you can do is use the Textbox's FocusLost event, and transfer the text to wherever.
Also you should consider whether or not the SurfaceGui is local. |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 06:47 PM |
script.Parent.FocusLost:connect(function(enterPressed) if enterPressed then script.Parent.Parent.Parent.Parent.Parent.Parent.Part.SurfaceGui.Frame.TextLabel.Text end end)
I got this far but how does the Text get on the Surface GUI from here? |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 06:49 PM |
script.Parent.Parent.Parent.Parent.Parent.Parent.Part.SurfaceGui.Frame.TextLabel.Text = script.Parent.Text |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 06:53 PM |
| Whats the Script.Parent.Text? |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 06:54 PM |
the textbox's text
also you should add a debounce |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 06:59 PM |
Its not working? I got this:
script.Parent.FocusLost:connect(function(enterPressed) if enterPressed then script.Parent.Parent.Parent.Parent.Parent.Parent.Part.SurfaceGui.Frame.TextLabel.Text = script.Parent.Text end end)
Im confuzed about the debounce thing |
|
|
| Report Abuse |
|
|
| |
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 07:00 PM |
| When i type like "12" then press enter nothign pops up on the surface GUI |
|
|
| Report Abuse |
|
|
| |
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 07:02 PM |
| I got error saying "Part is not a valid member of Players" |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 07:03 PM |
| Alright I had to add one more Parent but now I got another error saying "Part is not a valid member of DataModel". |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
| |
|
| |
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 07:32 PM |
| I did and I got this again "Part is not a valid member of Players" |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
| |
|
|
| 06 Mar 2015 07:39 PM |
surfacegui = game.Workspace.Part.SurfaceGui.TextLabel --Change that MaxChars = 3 --the amount of characters that can show up.
script.Parent.FocusLost:connect(function(enterPressed) if enterPressed then surfacegui.Text = string.len(script.Parent.Text,0,MaxChars) end end) |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 07:46 PM |
| Would I put that int he Surface GUI as a LocalScript or Script. Or put it in the TextBox? |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:47 PM |
| everything that has to do with GUIs should be a localscript. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:49 PM |
| Textbox, and not everything that has to do with gui's should be a local script. |
|
|
| Report Abuse |
|
|
DevKonner
|
  |
| Joined: 04 Feb 2012 |
| Total Posts: 519 |
|
|
| 06 Mar 2015 07:49 PM |
| Alright so it does work but when I type in "123" it shows "3" when I put in "2" it shows "1" and when I put in "1" it shows "1". |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:53 PM |
"Textbox, and not everything that has to do with gui's should be a local script."
Yes it should.
Name one thing which manages GUIs which should not be in a LocalScript. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:53 PM |
Im a moron....
surfacegui = game.Workspace.Part.SurfaceGui.TextLabel --Change that MaxChars = 3 --the amount of characters that can show up.
script.Parent.FocusLost:connect(function(enterPressed) if enterPressed then surfacegui.Text = string.sub(surfacegui.Text,0,MaxChars) end end) |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:55 PM |
| Ive created many NORMAL scripts inside gui's.....Infact, thats what I used to always do...But I havent done much with GUI's since the update for security. |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:58 PM |
That's because you don't really know what you're doing.
All GUI scripting should ALWAYS be done in LocalScripts. |
|
|
| Report Abuse |
|
|