I created this script following some instructions but I am not sure how I would change it so that if the F key is hit you sprint but if the F key is hit again you stop sprinting. I also would like an explanation as to how this script exactly works as I see this string stuff and and I am not sure what it even does.
--Put in Game.StarterPlayer.StarterPlayerScripts
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local mouse = player:GetMouse()
LastTap = math.floor(tick())
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == string.char(48) then
character.Humanoid.WalkSpeed = 30
end
end
)
mouse.KeyUp:connect(function(key)
key = key:lower()
if key == string.char(48) then
character.Humanoid.WalkSpeed = 16
end
end)

1 comment
Thanks! What would the code be though if I wanted to use the F key?