Is there a way to check and see if a player is walking in a localscript?
You can use the Running event to do this task for you and change a boolean every time it triggers.
Here's some code for you to inspect...
1 | local humanoid = game.Players.LocalPlayer.Character.Humanoid |
2 | local isRunning = false |
3 |
4 | humanoid.Running:connect( function (speed) |
5 | isRunning = speed ~ = 0 |
6 | end ) |
Yes, you can. The humanoid's Running
event can be used:
1 | local Player = game.Players.LocalPlayer |
2 | local Character = Player.Character |
3 | local Humanoid = Character.Humanoid |
4 |
5 | Humanoid.Running:connect( function (Walkspeed) |
6 | print ( "Player has started walking! The walk speed is: " ..Walkspeed.. "!" ) |
7 | end ) |
Use the Humanoid.Running event.
1 | game.Players.LocalPlayer.Character.Humanoid.Running:connect( function () |
2 | print ( "Player is walking" ) |
3 | end ) |
Humanoids have a Running even which is fired whenever the speed of the character changes. Use that and some logic, and you have a way to tell if the player is walking or not.
1 | local Walking = false |
2 |
3 | game.Players.LocalPlayer.Character:WaitForChild( "Humanoid" ).Running:connect( function (Speed) |
4 | Walking = (Speed > 0 ) |
5 | end ) |