Using Roblox services
With your programming experience so far, you have created scripts that are limited only to the functionality of built-in language features or the methods and events of instances. In Roblox, the use of services is necessary to add more complex behaviors and make use of additional events and methods that are needed within your game. You can think of these services as libraries that are used to work with different aspects of your game rather than specific data types.
Players service
Virtually every game makes use of the Players
service. The Players
service is visible within the Explorer window and is where all player
instances are kept. The PlayerAdded
event is a very commonly utilized event and is used to identify when a player joins a game server. The following code looks to print the name of any player who joins the game with a small message attached. Notice that the player who joins the game is provided as a parameter to the function associated with the...