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:
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)

2 comments
Pretty sure it's supposed to be string:byte not string.byte. Correct me if I am wrong.
I have a better solution to all of this. Easier to read instead of having all of those local variables.