Change of WalkSpeed Not Detected

Hi you all. I’m trying to detect when a player’s WalkSpeed changes value. For some reason, when the character’s WalkSpeed changes, nothing happens, even the print statement doesn’t print anything. I tried detecting the WalkSpeed value change different ways but it won’t work. Maybe it’s just something simple I’m missing.

Here’s the script (ServerScript):

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")
		
	humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
		
		print(humanoid.WalkSpeed)
		
		if humanoid.WalkSpeed > 25 then
				
			--Run Animation
			local runAnimationTrack = humanoid:LoadAnimation(runAnimation)
			
			if not runAnimationTrack.IsPlaying then
				runAnimationTrack:Play(0.1)	
			end
			
		end
		
	end)
	
end)

3 Likes

Walk speed is the maximum speed that the humanoid can walk not how fast its currently traveling.

3 Likes

Ohhhhhh, my bad for not realizing, but is there a way to actually detect if the character is going faster or not? Some other property?

3 Likes

You could get its velocity’s magnitude I think

2 Likes

I think maybe something called AssemblyLinearVelocity can help im not really sure tho try something like:

Character.PrimaryPart:GetPropertyChangedSignal("AssemblyLinearVelocity "):Connect(function()
    print((Character.PrimaryPart.AssemblyLinearVelocity).Magitude))
end)

Alright thanks, I’ll try this property

1 Like

How are you changing the value? Locally?? That won’t show up on the server.

1 Like

It is handled on the server, that’s why I said it is a server script

1 Like

Oh even when you change it? Bbbbbbbbbb

I printed the Velocity on both the server and the client, and it shows the same thing. So yes.

try this it returns the current speed and it works on server and client.

How does a character run by the way? Can’t it only walk faster?

cause Roblox call walking running idk. Just connect it then walk around and print the output.
change your walk speed and when you walk it will show the change…

ps: this doesn’t show when you change it will only show when you walk.

(NEVERMIND I did a while true loop to print it!!!) Hmmmm, for some reason nothing prints when I try to use this method

Could you provide your script and where you place it

The code works now, and the animation plays, but the animation doesn’t flow back to the walking or idle animations smoothly.

Here is the code, It is stored in ServerScriptService under a folder called AnimationManagement:

--Services
local Players = game:GetService("Players")

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


Players.PlayerAdded:Connect(function(plr)
	
	--Variables
	local character = plr.Character or plr.CharacterAdded:Wait()
	local humanoid = character:WaitForChild("Humanoid")
	
	local runAnimationTrack
	
	humanoid.Running:Connect(function(speed: number)
		
		print(speed)

		if speed > 25 then

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

			if not runAnimationTrack.IsPlaying then
				runAnimationTrack:Play(0.1)	
			end
		
		elseif speed == 0 then
			
			--Stop Animation
			runAnimationTrack:Stop()
			
		
		end
		
	end)

	
end)

Is there a way to flow these animations, since I tried using the flow argument when I used:

runAnimationTrack:Play(0.1)

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)

The only problem is that the run animation gets played constantly over and over again and basically only plays a fraction of it.
The output says this:
AnimationTrack limit of 256 tracks for one Animator exceeded, new animations will not be played.

Might be because the magnitude of the velocity is also constantly changing by the decimal, from advanced calculating. Not really sure how to fix the animation problem