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

Why can't I print the Internal Values provided by Changed event?

Hello, I was using the Changed event on the Humanoid of my player to print out what is changing as I move

humanoid.Changed:connect(function(property)
    print(property)
end)

and my output returns: "MoveDirection" "MoveDirectionInternal"

However, when I use the following code to print out the values of all properties changed:

humanoid.Changed:connect(function(property)
    print(humanoid[property])
end)

My output returns: "0, 0, -1" "MoveDirectionInternal is not a valid member of Humanoid"

I was wondering why this happens and if there are ways to print Internal values or skip over them?

2 comments

0

hmm, that's weird, it's like returning the value but at the same time it is thinking that the property is acting up as a child of Humanoid

0

not sure if you can bypass that honestly

1 answer

The 'property' parameter is the property that was changed, not the value is was changed to.

Take this code for example:

Code:

local Part = Instance.new("Part")
Part.Parent = workspace

Part.Changed:Connect(function(Property)
	print("Name of property: "..Property)
	print("New value of property: "..Part[Property])
end

wait()

Part.Name = "I changed this property"

Output:

--> Name of property: Name
--> New value of property: I changed this property

Source: Instance.Changed

Hope this helps.

Patch

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