Ah I see, that you for the update.
My LUA skills are next to none, so when you say the "Team()" function, would that be in replacement of "target_ply:Team()"? And the same goes for the "SetTeam()" function?
Your code takes in a
ULib.cmds.PlayersArg, which matches multiple players. But your code is built around
one player, so you would want to change
PlayersAarg to
PlayerArg. Optionally, you could also replace
target_plys with
target_ply to make your code more readable.
Those two adaptations to
ulx.afk (lines 136-151) should get you running.
Also, in contrast to what iViscosity said,
SetTeam is
serverside, so you should surround
target_ply:SetTeam(TEAM_SPECTATORS) with:
if SERVER then
-- your code here
end
Finally, your code is redundant—you check to see if the targeted player is
TEAM_HUNTERS or
TEAM_PROPS, but perform the same actions on both. Likely you were trying to exclude
TEAM_SPECTATORS, in which case you could use:
if target_ply:Team() == TEAM_HUNTERS or target_ply:Team() == TEAM_PROPS then
-- your code here
end