Change of WalkSpeed Not Detected

Try this:


local Players = game:GetService("Players")

local runAnimation = Instance.new("Animation")
runAnimation.AnimationId = "rbxassetid://16754777947"


Players.PlayerAdded:Connect(function(plr)

	local character = plr.Character or plr.CharacterAdded:Wait()
	
	local humanoid = character:WaitForChild("Humanoid")
	
	local rootPart = plr.Character:WaitForChild("HumanoidRootPart")

	humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()

		print(rootPart.Velocity.Magnitude)

		if rootPart.Velocity.Magnitude > 25 then

			--Run Animation
			local runAnimationTrack = humanoid:LoadAnimation(runAnimation)

			if not runAnimationTrack.IsPlaying then
				runAnimationTrack:Play(0.1)	
			end

		end

	end)

end)