Skip to content

Client and Server

The client is the computer that is playing the game, and if you run a script on the client it will run for the current player on their computer. For example, if there is text on your screen (GUI) for the amount of coins you have, you should run a script on the client (LocalScript) so when you collect a new coin to update the text, because if you used a Regular/Server Script it wouldn’t make sense, because then it would show the amount of coins text you had would show everyone’s coins in total and not just yours. Another example would be if there was a game with a vault and the code was random for everyone, you would run a script on the client to set the code to a random code for you and it would be different for everyone. If your goal is to generate a random code for everyone, you shouldn’t use a Regular/Server Script because setting it on the server would make it the same random code for everyone, since it runs on the server. Also, With LocalScripts, you can get the current player on the script, which is useful for functions like in this example you could detect when that certain player collects a coin.

The server is the actual computer that Vortex is running on, its Vortex’s servers. If you run code on a server script, it affects everyone in the game with the exact same variable values, functions, etc. For example, if you make a red light green light game, you want to run a Regular/Server Script that actually shows the red light and green light randomly for everyone on the server, because if you did it on the client, it would show different red lights and green lights for all players, which would be very confusing. With Regular/Server Scripts, you cannot get the current player, because those scripts run on the server, so you would have to select one player individually, or multiple players.

You can run a script on the client by using a LocalScript, which will only run on the client. To run a script on the server, create a Regular Script, which is a server script by default.

LocalScripts/clients don’t just run on your computer, they run on everybody’s computer, just separately and not on the server. However, they aren’t a Regular Script. Every computer gets a separate copy of the LocalScript.

For example, if there was a LocalScript where when the player collects a coin to update the text that says “Your Coins: (coins)”, if Player1 collects a coin, and Player2 doesn’t, then only Player1 gets the updated text. However, if it is a Regular/Server Script, then if Player1 collects a coin, and Player2 doesn’t, then both players get the updated text, which wouldn’t make sense.

Quick recap:

  • The client is the computer that is playing the game, and LocalScript are scripts that run only on the client, which effects just the computer playing the game. Useful for GUI and more. If you create a script that shows a random number, it runs on everybody’s computer seperately, so it will be different every time.
  • The server is the actual computer that is on Vortex’s servers, and Regular Scripts are scripts that run only on the server, which effects everybody. If you create a script that shows a random number, it only runs on the server so everybody gets the same number.

Just know, that you shouldn’t use LocalScripts to check if the player is an admin and give them special powers, or really anything that could give the player an advantage, because hackers can and could manipulate local scripts by tricking the LocalScript into thinking it is an admin or getting those special powers. However, if on a Regular/Server Script you just check every player that joins and then see if they are an admin or deserves those special powers, because that is much safer for hackers because to edit that they would have to actually hack into Vortex’s servers.