I have a script that lets the player Sprint when Shift is pressed. The script is below. I wan't to make it so that everytime the Shift key is released theres a 3 second cooldown for when the Player can press Shift to Sprint again.
script.Parent:FindFirstChild("Ok").Parent.Text = "Sprint: "..script.Sprinting.Value
game:GetService("UserInputService").InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
script.Deduct.Value = true
while script.Deduct.Value == true and script.Sprinting.Value > 0 == true do
script.Sprinting.Value = script.Sprinting.Value - 1
print(script.Sprinting.Value)
script.Parent.Text = "Sprint: "..script.Sprinting.Value
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25
wait(0.2)
end
end
end)
game:GetService("UserInputService").InputEnded:connect(function(input)
if input.KeyCode ~= Enum.KeyCode.LeftShift then
print()
else
script.Deduct.Value = false
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
end
end)

2 comments
Sorry I got to you so late, I;ll ad you on discord if you need further help
Feel free to add me, i'll message you if any more issues come up. My discord is same dude#1436.