This isn’t a huge problem, but it just annoys me whenever I see the error in the console.
keyboard.InputBegan:Connect(function(input, notProcessed)
if notProcessed and not character then return end
local humanoid = character:WaitForChild("Humanoid")
...
I pretty much have UserInputService set to listen for inputs, and as soon as I run in studio, this is called. I have character set to nil when the script is started and will wait for the character to be added, but it still tries to find humanoid even when I try to check if character is nil.
I’m not sure if this is a bug or if I’m checking wrong, but I believe this should be how you check if a variable is nil.
It checks if the input is processed and if the character is not there.
If you want to not check for the humanoid if, and only if the character is not there, then considering:
if not character then return end
or (and yes, or is actually used, no pun intended) if you also want to not make the script continue depending on the process, then consider:
if notProcessed or not character then return end
or in this case stops the command depending on the process or if the character is not there. I’ve made this mistake too in the past, lol. Don’t worry.