Shift to run
Code is not working
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local UserInputService = game:GetService('UserInputService') UserInputService.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.W then Enum.KeyCode.W = true elseif Key:byte() == 48 then Enum.KeyCode.LeftShift = true end if input.KeyCode == Enum.KeyCode.LeftShift then Player.Character.Humanoid.WalkSpeed = 38 end end) UserInputService.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.W then input.KeyCode = Enum.KeyCode.W == false elseif Key:byte() == 48 then input.KeyCode = Enum.KeyCode.LeftShift == false end if not input.KeyCode == Enum.KeyCode.W or not input.KeyCode == Enum.KeyCode. LeftShift then Player.Character.Humanoid.WalkSpeed = 16 end end)
Hello,
You're trying to set an Enum: Enum.KeyCode.W = true
. You do this with multiple different key codes. This is not logical, and will throw an error.
You also need to use InputEnded to check when the player stops pressing a key. You're using InputBegan twice.
Also, you're using an outdated Key:byte(), when Key isn't even defined.
You need to check over your script and read your errors before asking for help on Scripting Helpers. We are here if you can't solve an error even after looking at your output and checking your script, or if you can't figure out how to do something.
Hope this is helpful,
Eqic.