Answered by
7 years ago Edited 7 years ago
I have not tested it out, it might not work.
An important thing is that you should put local before each of your variables.
An another important thing that you should use is UserInputService or ContextActionService, both of those services do a lot(ContextActionService can create custom buttons on the screen and with UserInputService, you could check what device the player is using and much more stuff)
01 | local player = game.Players.LocalPlayer |
02 | local uis = game:GetService( "UserInputService" ) |
03 | local char = player.Character |
04 | local hum = char.Humanoid |
06 | uis.InputBegan:Connect( function (key, gpe) |
07 | if key.KeyCode = = Enum.KeyCode.Q and not gpe then |
08 | hum.WalkSpeed = hum.WalkSpeed + amount |