Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

the Output keeps saying that humanoid isn’t part of character?

local UIS = game:GetService(“UserInputService”)
local Player = game.Players.LocalPlayer
local sprinting = false
local char = Player.Character

UIS.InputBegan:Connect(function(key, gameProcessed)
      if not gameProcessed then
         if key.KeyCode == Enum.KeyCode.Ctrl then
            if sprinting == false then
                local humanoid = char.Humanoid
                humanoid.WalkSpeed = 25
                 if humanoid.Walkspeed == 25 then
                     sprinting = true
                      print(Player.Name..”is running”)
                 end
            end
       end
end)

the Output keeps saying that humanoid isn’t a part of char. pls help

2 answers

✓ Accepted answer

You could try doing

local humanoid = char:WaitForChild("Humanoid")

I forgot how people usually say why this happens, something because the Humanoid has not loaded in yet or something, but that should work.

better practice is to put this in your function

char = player.Character or player.CharacterAdded:wait()

This discussion is preserved as it was. New answers, comments, and votes are closed.