devCryo
|
  |
| Joined: 17 Oct 2014 |
| Total Posts: 353 |
|
|
| 07 Nov 2015 11:26 AM |
In my script on the first line is
placeID = ID HERE
I made a GUI including a Text Box and need to figure out how to replace whatever number you put into the text box with ID HERE in my script, and then execute the script with a Click Button in the GUI. Can anyone help? |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 07 Nov 2015 11:40 AM |
http://wiki.roblox.com/index.php?title=API:Class/TextBox/FocusLost
This is a TextBox event that fires when someone either presses Enter or clicks outside of a TextBox.
Using this event, when Focus is lost, you can detect if the TextBox's (what the person inserted) text meets valid specification of a placeID (i.e. contains only numbers and stuff).
After that, for the TextButton to fire the TextBox, you use this event:
http://wiki.roblox.com/index.php?title=API:Class/GuiButton/MouseButton1Click
EXAMPLE CODE:
placeID = 'lol this is empty' TextBox = YOURTEXTBOXHERE Button = YOURBUTTONHERE
function focusLost() local insertedText = TextBox.Text if insertedText:match'%d+' == insertedText then -- If I grab all the numbers in insertedText and it equals to itself... placeID = insertedText end end
function buttonPressed() print('This button was pressed! placeID is currently '..placeID..'.') end
TextBox.FocusLost:connect(focusLost) Button.MouseButton1Click:connect(buttonPressed) |
|
|
| Report Abuse |
|
|
devCryo
|
  |
| Joined: 17 Oct 2014 |
| Total Posts: 353 |
|
|
| 07 Nov 2015 12:00 PM |
Thanks! I'm still pretty confused though xD
Seems difficult |
|
|
| Report Abuse |
|
|