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.

7 comments
Print ''arguments[1]'' and tell me the result, I think I know the issue
If 'arguments[1]' is "me", then you've changed the username to all lowercase. Clearly, your username will not match that
Furthermore, you're trying to make a reference to 'Humanoid.Health', which is something you cannot do; adjusting 'Health' will only adjust the variable
When you refer to a property, you read from it.
And why not just set 'Humanoid.Health' to zero?
And why search Workspace when you can just look into Player's directly?
You can use a remoteevent on the server to get the player and players character.