Breakdown: This script is designed for my upcoming RPG, and I am having an error, I spawn with 16 speed like normal, and how I would like. But, when I press shift my speed does not increase, and if it does its not by the correct increments.
Script:
01 | repeat wait() until game.Loaded |
02 | local Player = game.Players.LocalPlayer |
03 | local Character = Player.Character |
04 | local Humanoid = Character.Humanoid |
05 |
06 | local running = script.Running |
07 |
08 | local plr = game.Players.LocalPlayer |
09 | local player = game.Players:FindFirstChild(plr.Name) |
10 | repeat wait() until plr.Character |
11 | local character = game.Workspace:FindFirstChild(player.Name) |
12 | local mouse = plr:GetMouse() |
13 |
14 | mouse.KeyDown:connect( function (key) |
15 | key = string.lower(key) |
This is a sprint script I made a few weeks ago, it has animatios, but it broke the script if you consistantly spammed the shift button, so I got rid of them. Heres the localscript:
01 | game:GetService( "UserInputService" ).InputBegan:connect( function (input) |
02 | if input.KeyCode = = Enum.KeyCode.LeftShift then |
03 | game.Players.LocalPlayer.Character:FindFirstChild( "Humanoid" ).WalkSpeed = 35 |
04 |
05 |
06 | end |
07 | end ) |
08 |
09 | game:GetService( "UserInputService" ).InputEnded:Connect( function (input) |
10 | if input.KeyCode = = Enum.KeyCode.LeftShift then |
11 | game.Players.LocalPlayer.Character:FindFirstChild( "Humanoid" ).WalkSpeed = 17 |
12 | end |
13 | end ) |
Make sure to put this in StarterPlayer.StarterCharacterScripts as a local script
Please upvote if this is the solution to your problem C: