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

Why isn't this triggering the :Changed event?

function change()
	print(555)
end

script.Parent.Parent.Parent.HatSelectedValue.Changed:Connect(change)

The HatSelectedValue is an IntValue, if I try targeting the HatSelectedValue.Value I get an error. What can I do to fix this?

2 comments

0

That's a lot of parents. Can you show us a picture of where the script is stored? You may not be accessing it correctly.

0

If you get an error include it!! we do not know what the error is so we cannot help you. Follow https://scriptinghelpers.org/help/how-post-good-questions-answers when posting a question.

1 answer

You can check that the intvalue's value is changed using the :GetPropertyChangedSignal() function

Also, you can add the function connection in the same line as it definition

Using "WaitForChild" will wait until the child exists, you can also use this to see if the ancestry of the intvalue is correct since it will warn an infinite yield if not.

Revised Server / Local Script

local val = script.Parent.Parent.Parent:WaitForChild("HatSelectedValue")

val:GetPropertyChangedSignal("Value"):Connect(function()
	print(val.Value)
end)

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