local stats = script.Parent.Parent:WaitForChild("statistics")
print("stats")
local ability = game.Players.LocalPlayer:WaitForChild("ability")
print("ability")
local replicatedstorage = game:GetService("ReplicatedStorage")
print("replicatedstorage")
local statustag = replicatedstorage:WaitForChild("statustag")
print("statustag")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
print("humanoid")
local using = Instance.new("BoolValue")
using.Parent = game.Players.LocalPlayer
using.Name = "using"
using.Value = false
ability.Value = "fast"
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.E and using.Value == false and ability.Value == "fast" and statustag.Value == "Game in progress" then
using.Value = true
print("E pressed.")
repeat wait() until humanoid ~= nil
script.Sound:Play()
humanoid.WalkSpeed = humanoid.WalkSpeed + 20
wait(5)
humanoid.WalkSpeed = humanoid.WalkSpeed - 20
using.Value = false
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
When the player presses 'e,' their walkspeed is supposed to go up by 20.
I get the following error: Line 11: Attempt to index local 'character,' a nil value.
I don't quite understand how it is nil, as I defined it above.

1 comment
The Humanoid will never be in the Player, but your right that the repeat loop on line 22 is flawed.