Would changing player’s WalkSpeed be acceptable? I think it is a easy way how to do this and avoid other issues. You can change it using the TweenService to get a smoother effect, but it’s your choice!
EDIT: It would also be great to use :Disconnect(), as I see you are using in your script a bunch of :Connect()s. It is not really best for the preformance.
EDIT 2: For fix of the preformance issue with using bunch of :Connect()s I’d change this part of script:
repeat wait()
local function input_Began2(i, g)
if g or not table.find(keys, i.KeyCode) then return end;
if input.KeyCode == Enum.KeyCode.S then
isPressedAgain = true
end
end
userInputService.InputBegan:Connect(input_Began2)
until isPressedAgain == true or tick() - pressTime >= 0.5
to this:
local function input_Began2(i, g)
if g or not table.find(keys, i.KeyCode) then return end;
if input.KeyCode == Enum.KeyCode.S then
isPressedAgain = true
end
end
local con = userInputService.InputBegan:Connect(input_Began2)
repeat wait() until isPressedAgain == true or tick() - pressTime >= 0.5
con:Disconnect()