Edit: Silly ole me forgot to add what the 'delay' was. Basically when I hit shift it works perfectly when I release shift it'll delay an inconsistent amount of times before calling resetSpeed(). Sometimes instantly, sometimes after a few seconds, sometimes never.
Edit 2: I've tried a different method of putting the variable for humanoid inside the functions and changing the variable to be
humanoid=player.Character.Humanoid
I'm still receiving the delay and believe the error is in how I used the UserInputerService
So I'm creating a shift to sprint script, it is noteworthy that this is obviously inside a localscript just to clarify. Here is my code for now, I'm receiving no errors and can't find a place to start.
local player=game.Players.LocalPlayer
local plrname=game.Players.LocalPlayer.Name
local humanoid=game.Workspace:WaitForChild(plrname).Humanoid
local input=game:GetService("UserInputService")
local function changeSpeed(player)
humanoid.WalkSpeed=25
end
local function resetSpeed(player)
humanoid.WalkSpeed=16
end
input.InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
changeSpeed(player)
else
resetSpeed(player)
end
end)
I believe the most possible suspect here is:
local humanoid=game.Workspace:WaitForChild(plrname).Humanoid
The issue is I have attempted using player.Character.Humanoid, as-well as game.Workspace:FindFirstChild(plrname).Humanoid. Both return nil as (i believe) the script is executed before the players spawns in therefor it returns nil.

2 comments
local humanoid=game.Players.LocalPlayer.Character.Humanoid
I've tried this before, I get attempted to index "character" (a nil value) as I said in the question