I am programming a very simple store system in my game utilizing a textbox for user inputs. I have seen issues very similar to my one where the Textbox.Text wasn’t updating, however, they were all using server-sided scripts, whilst my script is a local script. Here is my code:
local InputField = script.Parent.Frame.TextBox
local Screen = script.Parent.Frame.Screen
if InputField.Text == "store" then
Screen.Text = "/ LIST OF PRODUCTS: \nFLASHLIGHT\nWALKIE-TALKIE"
end
The current hierarchy for my GUI is quite simple, it is: StarterGui/TerminalGUI/Frame/Screen.
It is important to keep note that my script is located inside of the TerminalGUI area.
well if this is the whole script then you should be doing InputField:GetPropertyChangedSignal() or InputField.Changed()
InputField:GetPropertyChangedSignal():Connect(function()
if InputField.Text:lower() == "store" then
Screen.Text = "/ LIST OF PRODUCTS: \nFLASHLIGHT\nWALKIE-TALKIE"
end
end)
your changing the gui in the part. You need to access PlayerGui
local Players = game:GetService("Players")
local player - Players.LocalPlayer
local ur_gui = player.PlayerGui.UR GUI_NAME_HERE
ur_gui.TextLabel.Text = "THIS WORKS NOW YAY!"
Changing the value works, it’s the input field (text box) that is not working. When the user inputs the text, it is not updating even after I press enter.
local InputText = InputField.Text -- Let's say InputText is "STORE"
print(InputText:lower())
--> This would print "store"
print(string.upper("home"))
--> HOME
i’d use string.lower() or string.upper() so your input isn’t case sensitive
Also, what GUI element is actually used to gain users input? I am currently using Textbox (The one with the green logo and the cursor inside.) is there another alternative?
you could use TextLabels or TextButtons and check if the player clicks on it, but that would just be extra work especially since a TextBox would do the same thing
Sorry for not reading it thoroughly, I’m away from my computer right now. I’ll add your solution in the morning. For now, I’ll mark your post as the solution.
Completely forgot about scripts only running once lol.