Hi guys! I have a sprint script and I am trying to stop the player from being able to sprint after they have clicked shift (used it) for 20 seconds? I have tried this but have not got it working - any ideas?? Any help would be appreciated :) Thanks.
local Plr = game.Players.LocalPlayer
local Mouse = game.Players.LocalPlayer:GetMouse()
local Cam = game.Workspace.CurrentCamera
counter = 0
Mouse.KeyDown:connect(function(key)
local Key = key:lower()
if Key:byte()==48 then
Plr.Character.Humanoid.WalkSpeed = 20
for i=1, 10 do
Cam.FieldOfView = (Cam.FieldOfView + 2)
wait(0.05)
while true do
counter = counter + 1
wait(1)
end
end
end
end)
Mouse.KeyUp:connect(function(keyy)
local Keyy = keyy:lower()
if Keyy:byte()==48 then
Plr.Character.Humanoid.WalkSpeed = 16
for i=1, 10 do
Cam.FieldOfView = (Cam.FieldOfView - 2)
wait(0.05)
while true do
wait(1)
if counter == 20
then
end
end
end
end
end)

1 comment
Thank you very much, but it doesn't seem to be working! I will try have and have a go at getting it to work, though!