Net message isn't reaching the server.

I’m sending a message from the client to the server as you can see here:

DButton.DoClick = function()
									net.WriteString("Testing, 123 net received")
								LocalPlayer():ConCommand("connect " .. k.. ";password "..table.concat(ppoppassword,"",v, v ))

This is the serverside of the stuff:

if SERVER then
	net.Receive("IPAddressGiver", function()

		--MsgN( net.ReadType() )
		MsgN( net.ReadString() )


Whatever I do, it won’t reach the server :confused:

What server are you trying to send it to? Because you can only send it to the current one.

Make sure that net.Receive code is actually ran.

I’m trying to run it on the current server, just from client to server, not to another server.

Those lines of code are in the autorun so I assume they’re loaded :stuck_out_tongue:

No errors? Is LocalPlayer():ConCommand(…) working? I mean, are you sure, that its the button you want to press?

Well they should be… Could you post a bit more code maybe? I have no clue why this wouldn’t be working

That’s because you have DButton.DoClick.

Try naming your button something else, like ‘myButton’ and see if it works then.

No errors at all, and yes this is the button that I want to press.

I’m not sure if you could’ve derived it from the ConCommand, but this is actually the serverhopper addon and I’m trying to find a way to actually post a message of which server the player’s going to join.

I cannot due to the fact that it’s an addon from scriptfodder called Server Hopper

Trying it with JBUTTON right now…
Edit: Nope, still the same.

Did you do a map change? - Sometimes fixes my issue with net strings.

Also, is your file even executing, do you see the button? - do you load the file via console command such as openscript or does it load automatically?
Also is it located in autorun or autorun/server, autorun/client?

Wow, gmod is really odd

I restarted the server for every change.
The file is located in autorun, not /autorun/server or /autorun/client.

It would if he had an addon that uses globals for elements and isn’t as creative with naming either.
I’ve seen that happen - someone had a HUD with buttons and whenever he hit button that was supposed to open inventory, it voted for mayor instead.



net.Receive( …

Check if your net functions are being ran.

Adding print on top of ‘DoClick’ would also help.

You actually can:

You’re going to override the default functionality of DButton and not the actual instance unless that variable is just a local.

This just prints serverworkstoo upon startup twice.

iworktoo doesn’t seem to wanna print even if I press the button, but I can tell that the button works because I still join a server if I click the corresponding button.

Well then clearly your problem is sending the net message, so look into problems in that code.

It should print clientside.

Add a timer to your connection, so it connects after 5 seconds - maybe it connects before message is sent.

Is it at all possible that you put “if SERVER then” inside the client-side part of the code?

In order for it to work you need to specifiy the network channel on startup serverside.

util.AddNetworkString( "The string I want to use net.Start with " ) 

Edit:** Just noticed you do have this… , Although to add…you shoulnt have the network stuff in a shared file, just purely a server file. I usually just use my own “data.lua” that i include in init.lua**

You should also just use net.WriteTable, and make sure youve stuffed all your arguments into a table. if your packing a string and a table together you can stuff that into one table and then upon receiving it do


Also for example,

local tableToSend = {
"Test string", testStringVariable, {tableVariable1,"someStringInTable"}, thisTableName = {someVariable,"the tableName is used to access like such, TableToSend['thisTableName']"}
//net stuff
//net stuff
//receive part
local args = net.ReadTable
//Just use the table, or you can unpack if you really want..useful for chat.AddText stuff
args = unpack(args)