hook PlayerSay not working

This wont work.

Every function is defined and working.

--[[Amod Command file Version 0.001A]]--
local command = {}

command.ID = 1
command.Name = "kick"
command.ChatCommand = "/kick"
command.Help = "Kicks a player."

function amodKick(ply, text)
	if ply:IsModerator() == true or ply:IsAdmin() then
		local text = string.lower(text)
		if(string.sub(0, 100)== command.ChatCommand) then
			local text = string.Explode(" ", text)
			local vicim = amod.FindPlayer(text[2])
			if(IsValid(victim)) then
				local target = vicim
			local admin = ply:Nick()
			if text[3] == "" or nil then
				ply:aNotify("[AMOD] Error, you must enter a player to kick!")
			local reason = table.concat({text}, " ", 3)
			target:Kick("Kicked by "..admin.."! Reason: "..reason)
			amod.AddChat("All", Color(255, 0, 150, 255), "[AMOD] ", Color(255, 255, 255, 255), admin.." has kicked "..target:Nick().."! Reason: "..reason)
		return ''
		ply:aNotify("[AMOD] You do not have access to this command!")
		return ''
hook.Add("PlayerSay", "amodKickAPlayer", amodKick)

Any reason why?

Any errors? Did you make the function isModerator? Because it is not a pre defined function in gmod. Are you running this serverside or clientside?


No errors.

You didn’t close the quote after the !

It looks like he did though… There’s a quote before ! But it doesn’t look like it’s making a text argument, might be something weird with facepunch code display or maybe something weird happened or I’m just not seeing why it looks like that. Definitely looks like that part should be fine though, aside from coloring (for whatever reason)

You aren’t giving string.sub its first argument. Target is gonna be nil because you defined it local inside of a empty statement. And with the way you’ve coded it unless someone is an admin or mod they won’t ever be able to type in chat.

EDIT: Also the reason is always gonna be empty because you’re concatting a table with 1 element and are trying to start the concat from the third element. Probably more things wrong with it to point out though this code hurts me inside ;-;
EDIT2: Looking at it again, it looks like spaghetti on-top of spaghetti on-top of spaghetti, soo much of this doesn’t make any sense to do.

Did you mean victim or vicim?

fuck me

thx ill test it out.

I think that’ll do it, the code looks fine.

Didn’t work.

Throwing in the towel fuck dis.