How to connect to a Function using GetPropertyChangedSignal

Hi there,

I am trying to figure out how to get a Text Label’s text to change after the Screen Gui’s Parent property has been changed. So far, at least according to my testing, the script detected the change in property but it does not run the function. No error messages.

local PGText = script.Parent         --  Text Label
local SG = script.Parent.Parent.Parent  -- Screen Gui


function test()
	print("Hello")
end


SG:GetPropertyChangedSignal("Parent"):Connect(test)    

Actually, I tested this thing in my studio.

-- script.Parent was a basePart
local function test()
    print('hello')
end

script.Parent:GetPropertyChangedSignal('Parent'):Connect(test)

This code didn’t work.
Another code :

script.Parent:GetPropertyChangedSignal('Parent'):Connect(function()
    print('hello')
end)

This code also didn’t work.

As I said, both codes didn’t work, and I think this isn’t just the script problem, but Roblox’s.
other properties changing fires the event (GetPropertyChangedSignal) but ‘Parent’ Property doesn’t.
I think roblox will fix this soon? idk maybe.

( ‘Parent’ Property changing DOESN’T fire the event GetPropertyChangedSignal I think. )
( It may be fixed soon ( not sure ) )

are you sure you test it properly? cuz the code will only works on the screengui put on the player’s PlayerGui you just might test the one put on the StarterGui which wont run the code

but anyways i recommended using AncestryChanged instead

1 Like

Figured out a workaround for myself. Thanks anyways.

i will suggest you explain how you solved this problem incase someone encounters this exact problem that you had.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.