Addon Broken?



-- Global voice chat
-- By Velkon

local Voice = {} -- Don't touch

-- Currently only supports ulx. Just edit the function in line 17 for other admin mods
Voice.Allowed = { -- The groups allowed to global voice chat
	"owner", -- Remember to have a comma after each one
	"staffmanager"
}

Voice.Command = "!servervoice" -- The chat command

-- END OF CONFIG --
hook.Add("PlayerInitialSpawn","voice.setup",function(ply) ply.IsGlobalVoice = false end)
hook.Add("PlayerSay","voice.global.cmd",function(ply,txt)
	if !Voice.Allowed[ply:GetUserGroup()] then return end
	local txt = string.lower(txt)
	if txt == Voice.Command then
		if !ply.IsGlobalVoice then
			timer.Create("voice.alert"..ply:SteamID(),4,0,function()
				ply:PrintMessage(HUD_PRINTCENTER,"[Voice chat] You are talking to the whole server!")
				-- HUD_PRINTTALK
			end)
			ply:PrintMessage(HUD_PRINTCENTER,"[Voice chat] You are talking to the whole server!")
			ply:PrintMessage(HUD_PRINTTALK,"[Voice chat] You are talking to the whole server!")
			ply.IsGlobalVoice = true
			return false
		else
			timer.Destroy("voice.alert"..ply:SteamID())
			ply:PrintMessage(HUD_PRINTTALK,"[Voice chat] You stopped talking to the whole server!")
			ply.IsGlobalVoice = false
			return false
		end
	end
end)
hook.Add("PlayerCanHearPlayersVoice","voice.work",function(him,ply) if ply.IsGlobalVoice then return true end end)


could someone debug this code its not working for some weird reason. Cant find the issue

what