here is the script
local box1 = script.Parent.Parent.TextBox
script.Parent.MouseButton1Click:Connect(function()
print(box1.Text)
end)
here is the script
local box1 = script.Parent.Parent.TextBox
script.Parent.MouseButton1Click:Connect(function()
print(box1.Text)
end)
Well, I think the problem here is that the variable does not really update with the GUI. So, to make it update, try using a .Changed event to detect if the text has been updated or not. And, I recommend making a separate variable of the "Text" property rather than the whole thing itself. (it makes it easier)
local box = script.Parent.Parent.TextBox -- variable for the box
local boxText = box.Text -- make a separate variable for the text
box.Changed:Connect(function() boxText = box.Text end) -- update the boxText variable each time the text changes
script.Parent.MouseButton1Click:Connect(function()
print(boxText)
end)
I hope this helps!
You locate the text if it is " ". You just have to locate the text in the function!
local box1
script.Parent.MouseButton1Click:Connect(function()
box1 = script.Parent.Parent.TextBox
print(box1.Text)
end)
And... Dont use numbers for variables :D
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
is this a screen gui or a surface gui?
Screen