Basically a sprint system. No output errors just nothing happens, anyone know whats wrong? Any help is appreciated and here's the code:
player = script.Parent.Parent character = player.Character local sprinting = false function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then if sprinting == false then sprinting = true character.Humanoid.WalkSpeed = 24 wait(8) character.Humanoid.WalkSpeed = 16 else character.Humanoid.WalkSpeed = 16 end end end game.ContextActionService:BindAction("keyPress", onKeyPress, false, string.char(48))
Edit: It's in StarterPlayerScripts
player = game.Players.LocalPlayer character = player.Character local sprinting = false function onKeyPress(actionName, userInputState, inputObject) if userInputState == Enum.UserInputState.Begin then print("test") if sprinting == false then sprinting = true character.Humanoid.WalkSpeed = 24 wait(8) sprinting = false character.Humanoid.WalkSpeed = 16 else character.Humanoid.WalkSpeed = 16 end end end game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.LeftShift)
Change
string.byte(48) to Enum.KeyCode.LeftShift
Confirmed working.
http://wiki.roblox.com/?title=API:Enum/KeyCode
All the best.