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.
repeat wait() until game.Loaded local Player = game.Players.LocalPlayer local Character = Player.Character local Humanoid = Character.Humanoid local running = script.Running local plr = game.Players.LocalPlayer local player = game.Players:FindFirstChild(plr.Name) repeat wait() until plr.Character local character = game.Workspace:FindFirstChild(player.Name) local mouse = plr:GetMouse() mouse.KeyDown:connect(function (key) key = string.lower(key) if string.byte(key) == 48 then if running.Value == false then running.Value = true Humanoid.WalkSpeed = Player.ServerTraits.Statistics.Speed.Value * 0.01 + 16 elseif running.Value == true then running.Value = false Humanoid.WalkSpeed = 16 end end end)
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:
game:GetService("UserInputService").InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").WalkSpeed = 35 end end) game:GetService("UserInputService").InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").WalkSpeed = 17 end end)
Make sure to put this in StarterPlayer.StarterCharacterScripts as a local script
Please upvote if this is the solution to your problem C: