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 » Scripters
Home Search
 

Re: GUI Text Box and Executing Script Functions Help

Previous Thread :: Next Thread 
devCryo is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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