Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I use GetPropertyChangedSignal?

Asked by
GShocked 150
7 years ago
Edited 7 years ago

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

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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.

0
Thanks! I adjusted it to LocalPlayer's PlayerGui and it works now GShocked 150 — 7y
Ad

Answer this question