|
| 13 Jul 2014 08:32 PM |
I am making a Mainframe where you can enter data, but I don't know how to test for the text a user typed into a textbox. Can someone help? This doesn't work right, apparently. It's a script inside the textbox.
script.Parent.FocusLost:connect(function() if script.Parent.Text then end end)
Caaaactus. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
MHebes
|
  |
| Joined: 04 Jan 2013 |
| Total Posts: 2278 |
|
|
| 13 Jul 2014 08:51 PM |
Your conditional doesn't make any sense. Did you mean if the text wasn't empty?
if script.Parent.Text ~= "" then |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 08:53 PM |
No, the text in the textbox is originally set to [PLAYER_NAME_HERE] The player should be able to type in the box, which works. It changes the text on screen, but it doesn't change the value.
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 08:57 PM |
| Try changing it through that Player's PlayerGui. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 08:58 PM |
uh... what? I can't collect the data, and they won't be entering there own name...
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:01 PM |
| What exactly are you trying to use the mainframe for?. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:02 PM |
For my group, we'll be saving Points earned at player events to earn promotions.
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:06 PM |
Try doing this
script.Parent.InputChanged:connect(function() if script.Parent then print(script.Parent.Text) end end) |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:09 PM |
Doesn't change it, it just spams my output with whatever i typed in. It doesn't change the value, though.
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:13 PM |
I thought that was what you wanted it to do, sorry. Now, I think that you're trying to find if a player's text is equal to some certain text.
script.Parent.InputChanged:connect(function() if script.Parent.Text = "TheSuperSecretString" then print("Omg, he found it out") end end) |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:14 PM |
Had an error.
if script.Parent.Text == "TheSuperSecretString" then |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:16 PM |
I don't know what the input will be! It's not like a passw0-rd to a door! It's creating a datafile!
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:21 PM |
Still a bit confused... What do you mean by creating a datafile? If you mean by putting the text the user typed into a string then I prefer that you use a button to make sure that it doesn't create a bunch of objects.
Put this script inside a textbutton
DataFile = {}
script.Parent.MouseButton1Click:connect(function() if string.len(script.Parent.Parent.TextBox.Text) >= 1 then DataFile[#DataFile+1] = script.Parent.Parent.TextBox.Text for i=1,#DataFile do print(DataFile[i] end end end)
Try that, I'm not very experienced with Tables. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:23 PM |
.... Here, look. /OLUFPlH,1CgtNWT
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:24 PM |
All the textbox should do is allow you to type a name in, and it should change the TextBox Value's "Text".
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:26 PM |
| Then do you want it to check to see if a Player with that Name is in existence?. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:27 PM |
| Whenever you type inside a TextBox, by default, it will already update the TextBox's text to what you typed in. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:35 PM |
It doesn't. watch. https://www.youtube.com/watch?v=ARJdiXc7MvY&feature=youtu.be
Caaaactus. |
|
|
| Report Abuse |
|
|
|
| 13 Jul 2014 09:41 PM |
...
You went inside the StarterGui, not the player's Gui. |
|
|
| Report Abuse |
|
|
| |
|