I would actually recommend using userinputservice, yes it is more writing but at least you won't bother by checking all the time which numbers were space, control or in your case shift, also i've heard that it doesn't work anymore and im too lazy to check so there is this one:
wait()
local human = script.Parent:FindFirstChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.LeftShift then
human.WalkSpeed = 60
end
end)
UserInputService.InputEnded:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.LeftShift then
human.WalkSpeed = 16
end
end)
NOTE: in order for this script to work it must be in StarterPlayer>StarterCharacterScripts or StarterPack also note out that it must be localscript and it must not stay inside of another model/script/tool/etc.
5 comments
use if not gameProcessed then ...
@yHasteeD ye, that might be an option but i just enjoy making the scripts long, scripting gives me joy so the longer the more fun for me.
-1. Too many comments, makes it harder to read. You can improve readability by shortening the comments or moving them outside of the code, or not having them at all.
@incapaxian I don't quite get your point, I put all the comments so that people can read them and maybe learn what every part does and maybe learn how to do them alone.
richboyfexekapapa ill try the script when i have the time.