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