Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I use GetPropertyChangedSignal?

I have a text input box and a text label. I want the text label to change based on what is entered in the input box.

I'm trying to figure out how to use this function to initiate a change in my text label when the text input box changes.

Here's my current attempt:

game.StarterGui.ScreenGui.MbsV:GetPropertyChangedSignal("Text"):Connect(function(text)
	print("Text:", text)
end)

But it doesn't do anything. I don't know how this function is supposed to be formatted or used. There's no documentation on this that I can find.

http://wiki.roblox.com/index.php?title=API:Class/Instance/GetPropertyChangedSignal

1 answer

✓ Accepted answer

Your problem is that the method doesn't return the new value of the property, so 'text' will be nil. You have to index the property again.

local object = game.StarterGui.ScreenGui.MabsV

object:GetPropertyChangedSignal("Text"):Connect(function()
	print("Text:", object.Text)
end)

Note: Guis seen in game are in the Player's PlayerGui, not StarterGui - so this script is expected to only really be used from the command bar in studio.

1 comment

0

Thanks! I adjusted it to LocalPlayer's PlayerGui and it works now

This discussion is preserved as it was. New answers, comments, and votes are closed.