Slay command not working

hai everyone, im trying to make a slay command for my new gmod server but its not working ^^

heres the code

add.ConsoleCommand(slay, function( player, command, arg )
for k v in ipairs( players.getall )
if Name = arg then
Kill()
end

thanks

Well, let’s go over a few things first.

  1. Please use [noparse][lua][/lua][/noparse] tags around your code to make it easy to view.
  2. Your syntax is pretty awful:
  3. concommand.Add
  4. “slay”
  5. player.GetAll()
  6. player:Name()
  7. arg[1]
  8. player:Kill()
  9. end)

I think you should try and learn some basic Lua before trying to make anything.

[lua]
concommand.Add(“slay”, function( p, c, a )
for _, v in ipairs( player.GetAll() ) do
if string.find( string.lower( v:Nick() ), string.lower( a[1] ) ) then
v:Kill()
end
end
end )
[/lua]