Hello. I’m trying to make a system where a player inputs numbers into a TextBox and clicks a button to print those numbers. Everything is in StarterGui and the script is Local.
local TextButton3 = script.Parent
local Players = game:GetService("Players").LocalPlayer.PlayerGui
local TextBox = Players.TextBox
TextButton3.MouseButton1Click:Connect(function()
local playerNumber = (TextBox.Text)
print(playerNumber)
end)
You’re referring to your Textbox incorrectly. Instead of calling the ScreenGui “ChatBox1” and the Frame within it, you’re skipping both of those, which may cause an error. Replace your “TextBox” variable with the line of code below:
local Players = game:GetService("Players").LocalPlayer.PlayerGui
local TextBox = Players.ChatBox1.Frame.TextBox
Oops. I fixed the path and even then it doesn’t seem to print the input of the player. Could I just route the text from a TextBox function into a variable and then print the variable with a button press?