How to check if `WalkSpeed` Changed

I am creating a slow effect in my game and want it remove itself after 5 seconds.

I created a script inside a mob to try and track when the WalkSpeed changes, and to change it back.

Summary
local mob = script.Parent
local baseSpeed = mob:WaitForChild("BaseSpeed").Value

mob.Humanoid.WalkSpeed.Changed:Connect(function()
	wait(5)
	mob.Humanoid.WalkSpeed = baseSpeed
end)

This is the only way that I know for tracking a Change, but I get the error:
attempt to index number with 'Changed'

1 Like

Try:

mob.Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
3 Likes

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