Script

Script : BaseScript

Overview

The Script class often referred to as a Server Script, is a type of script that executes Lua code on the server-side. It is used to handle game-wide logic and operations that affect all players, such as managing game states, spawning objects, or processing events that need to be synchronized across the server. Unlike LocalScript, which runs on the client, Script has authority over the entire game environment and can make changes visible to all players.

Description

The Script class is a fundamental component of scripting system, enabling developers to implement server-side logic for their games. It runs in the server context and interacts with server-side services and objects.

Key Feature

  • Server-Side Execution:

    • Scripts run on OVERDARE servers, meaning any changes made by a Script are replicated to all players in the game. For example, if a Script destroys an object in the workspace, it will disappear for every player.

  • Global Authority:

    • Since it operates on the server, a Script has access to server-only services like ServerStorage and can manage shared game states or data.

    • It ensures secure execution of critical game logic because client-side scripts (LocalScripts) cannot modify server-controlled elements directly.

  • Event Handling:

    • A Script can listen for and respond to global game events such as player joins (PlayerAdded) or character spawns (CharacterAdded).

  • Communication with Clients:

    • While Scripts cannot directly interact with client-side objects like GUIs, they can communicate with LocalScripts using RemoteEvents or RemoteFunctions.

Properties

Methods

Events