I am not quite sure how I would create a sprinting script. I read the wiki a few times but it doesn't quite explain how I would do this. I somewhat know what to do but I am not quite sure if I am doing this right or if this is the most efficient way to do this. I have what I think is close to correct below, but any help would be appreciated.
player = game.Players.LocalPlayer
while wait() do
if (key:byte() == 48 or key:byte() == 47) and (key == "w" or key == "a" or key == "s" or key == "d" or key:byte() == 17 or key:byte() == 18 or key:byte() == 19 or key:byte() == 20) then --checks to see if they have either of the shift keys and any directional key held down
player.Character.Humanoid.Walkspeed = 18
else
player.Character.Humanoid.Walkspeed = 16
end
end
As I stated before, I'm not quite sure if this is relatively right, but I think it's close. Any help is welcome.

2 comments
sorry, I forgot to include that part of the code. The reason I wanted to see if they were moving was because I was going to decrease their stamina. I should've explained myself a bit more thoroughly.
Edited my answer to include that in a hopefully elegant solution