Net Library is a HUGE…I mean MASSIVELY HUGE part of Glua. You need to understand and learn how the server and client talk back and forth. <CODE BLUE> will help you, check the link out below. But “net.Receive” is your puppy in this case.
First, open the script server side. Then open it client side. The result will be in the console “1 + 5 = 6”. In this case we are asking for no input, and sending with four bits.
if (SERVER) then
util.AddNetworkString("myNetString") -- Register the Network String
function additionX(a, b) -- Simple function returns a + b
return a + b
net.Receive("myNetString",function() -- When the server receives the clients Network information
local a = net.ReadInt(4) -- a = 1, receiving with four bits
local b = net.ReadInt(4) -- b = 5, receiving with four bits
print(additionX(a, b)) -- Print the return value of the function, with our defined parameters.
net.Start("myNetString") -- Start the Network String
net.WriteInt(1, 4) -- Write the first part as 1, with bits as four. The server will receive these numbers in order as we send them.
net.WriteInt(5, 4) -- Write the second part as 5, with bits as four. Realize that you have to send and receive with the same bit size.
net.SendToServer() -- Send what we have to the server.