attempt to call field 'AddNetworkString' (a nil value)

Hello, sorry for my bad english, i’m French :stuck_out_tongue:

First, clientside hooks StartChat. After that, the function PlayerStartChat precache, prepare and transfer the name of the player (ply) to the server. After that, the server do that he would do.
Or, to fix that, if you know another way for the server get the name of the player who have oppened his chat… ^^

The error is on the line : util.AddNetworkString( “PlayerName” )
Can you help me please ? ^^


net.Receive( "PlayerName", function( len, client )
	ply = ""
	local ply = net.ReadString()
		-- The serverside script part, we don't this part for my problem.
	end
	 
 end )

local function PlayerStartChat(boolean)
		local ply = LocalPlayer()
		util.AddNetworkString( "PlayerName" )
		net.Start( "PlayerName" )
		net.WriteString( ply )
		net.SendToServer()
end
hook.Add( "StartChat", "PlayerOpennedTheirChat", PlayerStartChat)

util.AddNetworkString is serverside you are calling it clientside

the rest of the code is so syntactically and logically wrong though it doesn’t even matter - maybe learn Lua first.

in my experience - you can’t teach logical thinking. Either someone’s got it, or they don’t.