Need help with chat system!

The chat system I’m using for my gamemode is fucked up. I can’t figure out exactly what is causing this.

When in-game, the console gives me this error:


ERROR: GAMEMODE:'PlayerCanHearPlayersVoice' Failed: gamemodes\plague\gamemode\chatsystem.lua:110: attempt to compare number with nil

So I went to chatsystem.lua and went down to line 110:


function GM:PlayerCanHearPlayersVoice( plOne, plTwo )
	local ply1pos = plOne:GetPos()
	local ply2pos = plTwo:GetPos()

	if server_settings.Bool( "sv_alltalk", 0 ) then
		return true
	elseif plOne:Alive() then
		return ply1pos:Distance( ply2pos ) <= GAMEMODE.VoiceChatDistance -- This is line 110
	else
		return not plTwo:Alive()
	end
end

Any help with this would be greatly appreciated.

Im guessing GAMEMODE.VoiceChatDistance is not set to a value so give it one

Oh and you can return true as a second argument for 3D voice.