"calling_ply" is never defined (but in this case, you have defined "target_ply" as the calling player). You also never defined "#T" in the log, which would normally be "target_ply".
If you're planning to run this command on other players you will have to do some changes.
First change line 3 to this:
function ulx.respawn( calling_ply, target_ply )This will define the "calling_ply" or "calling player" and also having the target player.
Line 7 - Change it to this:
ulx.fancyLogAdmin( calling_ply, true, "#A respawned #T", target_ply )So the "#T" is set to the target_ply. Another thing you should do, is to also move the log into the "if" statement, so that it doesn't log every time someone tries to use the command, but they're actually alive and doesn't get respawned.
Line 11 - This can be done different ways, but for simplicity's sake, change "PlayersArg" to "PlayerArg" (notice the lack of "s"). Unless you'd like to do a loop through a player table and respawn more than one player in one go.
However, if you're planning on using this so the person using the command respawns themselves, it's advised to do some different changes.
Line 3 - Change "target_ply" to "calling_ply". Just for reference sake:
function ulx.respawn( calling_ply )
Line 4 and 5, change "target_ply" to "calling_ply" as well:
if not calling_ply:Alive() then
calling_ply:Spawn()
Line 7 - Change the logging to "#A respawned themself". "#T" wouldn't be defined at all in this case, and isn't necessary:
ulx.fancyLogAdmin( calling_ply, true, "#A respawned themself" )Also good idea to move it inside the "if" statement, as I said earlier.
Line 11 - Remove it completely. You don't need a "PlayerArg" as you're only using "calling player", so it's not needed at all.