How would I be able to detect a players speed

How would I go about making it so if they are walking/going for example 16 walkspeed. How would I make it so they cant walk when for example sliding. and only running

Humanoid.WalkSpeed = 0 for when they’re sliding, and when running, just do Humanoid.WalkSpeed = (running speed here)

oh i noticed my mistake, I meant how could I make it so you can only run and then press C to slide and if your walking and you press C you wont be able to slide

You can use humanoid.movedirection.magnitude to find if the speed is greater than a certain amount in studs per second. Here is sample code:

If game.Players.LocalPlayer.Character.Humanoid.MoveDirection.Magnitude >= 16 then
    — Code here
end

I did that but it just came out as “Incomplete statement: expected assignment or a function call”

Is it a local script? My code was just an example of how to use movedirection. Inside the if/then statement you put in the code that makes the player’s slide animation play.

the I in the word “If” should not be capitalized, try this:

if game.Players.LocalPlayer.Character.Humanoid.MoveDirection.Magnitude >= 16 then
    — Code here
end