So, for the past 2 days I have been trying to get a button (made in cl_init.lua) to run a function (which is in init.lua). The button is fine and it works because I can test it with a print command. I have boiled it down to using the Net library (which is new to me).
What I have tried to do is this: (This is the button in the cl_init.lua)
if (player:KeyDown(IN_USE)) then --This will just change to color of the button when pressed surface.SetDrawColor(0, 0, 0, 240) net.Receive("collect") end
This is the other stuff (function, other Net stuff in the init.lua)
util.AddNetworkString("collect") net.Start("collect", collectBtn) net.SendToServer() function collectBtn() print("test") end
This is what I have tried, have I got the Start and the Receive the wrong way round, I did try it the other way. Also, with this I get no errors, nothing happens and no errors show. Is it something to do with the function or what?! I appreciate any help.