Any serverside altneratives to humanoid.Running?

Hey so I want to make footsteps in my game which are serversided however .Running does not work on the server which is the only way I know to get the players movement speed to play the footsteps at the right speed. The reason I cant just use .Running on the client and use remote events is that I also want NPCs to be able to produce footstep sounds but since .Running only works on the client it wont work for NPCs so I need an alternative. I thought of using AssemblyLinearVelocity of the humanoidrootpart but I am not sure how to get a speed off of that. Any help is greatly appreciated!

Use Humanoid.MoveDirection, I think this will work or Humanoid:GetState

2 Likes

This does not tell me the speed at which the player is going only the direction. I utilize the playback speed on the footstep sounds to adjust it with the players speed.

Is the player not going a set speed, if they aren’t or if they are, I don’t know, but wouldn’t Humanoid.WalkSpeed work.

1 Like

getting walkspeed wouldn’t work as
A. its set on the client
B. if a player is standing still their walkspeed is still 16. I want to be able to tell when a player is moving and how fast they are going.

1 Like

Use this - MoveDirection.Magnitude > 0 if this runs it means the player is moving, and I am assuming the WalkSpeed doesn’t change, but even if it does WalkSpeed replicates. (And I am pretty sure .Running works on the server too, it is just kinda weird)

1 Like
local isRunning = false

game:GetService("RunService").Heartbeat:Connect(function()
	isRunning = if (Root.AssemblyLinearVelocity * Vector3.new(1,0,1)).Magnitude > 1 then true else false
	
	print(isRunning)
end)
2 Likes

This wouldn’t run for everything in the game like he wanted, you would have to define this function or call it a bunch of times for every NPC, and Player. Correct me if I am wrong.

1 Like

do walkspeed. basically, find the movedirection.magnitude which can be 0 to 1.
multiply the magnitude by walkspeed to find exact speed at which he is going. for example, initial state will be 0. final state will be 16. 0.5 state will be 8.

1 Like

This seems promising I will try it when I get on studio in a bit and I’ll let u know if it works.

Look at my previous comment, you would have to edit it heavily

1 Like

Not really. I can just apply that in a script with every NPC.

True

charrrrrrrrrrrrrrrrrrrrrrrr

1 Like

isn’t this client sided?
runservice doesn’t work on the server

1 Like

HeartBeat and Stepped do, however RenderStepped is client sided

2 Likes

This works PERFECT and lets me get the speed thank you! Only thing I recommend for anyone replicating this is to make sure to ignore the Y value in assemblylinearvelocity by making a new vector3 using the assemblylinearvelocity X and Z but 0 instead of the Y value.

Edit: I realized you already did that by making it * Vector3.new(1,0,1) oops!
Works perfectly!

1 Like