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

why can't I detect changes in a humanoid property?

Asked by 1 year ago
Edited 1 year ago

In my game I'm trying to detect when the characters JumpPower changes so I used the .Changed event. No matter what I do I cant make this event work with any specific humanoid properties. Here is the current script I have that doesn't work.

wait(0.1)

local humanoid = script.Parent:FindFirstChild("Humanoid")
local jumppower = humanoid:FindFirstChild("JumpPower")

jumppower.Changed:Connect(function(stat)
    print(stat)
end)
0
BTW this script is inside (starter character scripts) ItsRealAJ 2 — 1y

1 answer

Log in to vote
0
Answered by
OhManXDXD 445 Moderation Voter
1 year ago

Try using Instance:GetPropertyChangedSignal() to check if the JumpPower property changes.

wait(0.1)

local humanoid = script.Parent:FindFirstChild("Humanoid")

humanoid:GetPropertyChangedSignal("JumpPower"):Connect(function(stat)
    print(stat)
end)

Learn more about it here: https://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal

Ad

Answer this question