Each computer only knows about variables that are defined on itself. To get a variable to be defined on the Server and then have all the computers (clients) be updated with its value you need to use the publicvariable statement which actually transmits that variable and its value to all the connected computers.
So you would use
globalvariable = true;
publicvariable "globalvariable";
... its now been sent to all other computers and you can refer to it. If your client code runs before the server code has sent the variable it will be nil and your code won't work as expected which is where the event handlers come in handy.
You can also do more advanced things like change the value of the pubvar between the client and the server with the PublicVariableServer & PublicVariableClient commands
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.