I've searched through so many devforum posts yet I have not found an answer. I need to find the character to get the humanoid so when a player activates an admin command to kill a player, the player stated is killed. Here's my script.
Once again, it's a server script.
commands.kill = function(sender, arguments) print("Kill command fired by "..sender.Name) local plrToKill = arguments[1] if plrToKill == "me" then plrToKill = string.lower(sender.Name) arguments[1] = plrToKill end local plrChar = game.Workspace:FindFirstChild(plrToKill) if plrToKill then local plr = findPlayer(plrToKill) if plr then local plrHum = nil local health = nil print(plrChar) plrHum = plrChar.Humanoid print(plrHum) health = plrHum.Health print(health) health = health - 100 end end end
Everything else works fine, but I get an error saying "attempt to index nil with 'Humanoid' which I find very confusing. Any help is greatly appreciated.