How do you use TextBox:GetPropertyChangedSignal on a SurfaceGUI?

Hello! I made a script that needs to check if a TextBox’s Text and number are the same. My goal is to get make it so when a character is typed, a script gets notified and changes the Text in the properties tab to be what is typed.

Problem: However, when you type or click off the box, the Text section is properties doesn’t change. While there are solutions like this one, these don’t seem to work on a SurfaceGUI, but rather a screenGUI.

’Attempts’: So far, I’ve tried adding a script under the TextBox with scripts in the previously linked problem, but I haven’t gotten anything to work yet.

Is there a certain GetPropertyChangedSignal for SurfaceGUIs that I haven’t discovered?

Thanks.

TextBox Input is always local, use a localscript to trigger a remoteevent whenever the text is changed. and send over the text to the main script.

1 Like

Okay, let me see if that works, thanks!

I gave up, but I think this was the solution, so thanks!

Here’s some articles to help you!

https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

https://developer.roblox.com/en-us/api-reference/class/RemoteEvent

Along with some code to get you started.

Local Script

local MyRemoteEvent = game.ReplicatedStorage.MyRemoteEvent
local MyTextBox = script.Parent

MyTextBox:GetPropertyChangedSignal("Text"):Connect(function(txt)
   MyRemoteEvent:FireServer(txt)
end)

ServerScript

local MyRemoteEvent = game.ReplicatedStorage.MyRemoteEvent
local MySurfaceGuiTextLabel = --Put your stuff here

MyRemoteEvent.OnServerEvent:Connect(function(PlayerWhoSent, TextThatWasSent)
    MySurfaceGuiTextLabel.Text = TextThatWasSent .. " -" .. PlayerWhoSent.Name --If I sent "Hello", it would make it "Hello -Benpinpop"
end)
1 Like