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

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

Asked by 5 years ago

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?

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 starmaq 1290 — 5y
0
not sure if you can bypass that honestly starmaq 1290 — 5y

1 answer

Log in to vote
0
Answered by
Patch 0
5 years ago
Edited 5 years ago

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

Take this code for example:

Code:

```lua 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

Ad

Answer this question