Script Overview
Last updated
Last updated
OVERDARE Studio provides the Lua scripting language to support creative game development. Creators can use Lua scripts to freely implement various game mechanics, such as killing a character that touches a specific object or starting the game after a countdown.
OVERDARE Studio offers three types of scripts, each serving a unique purpose.
Script
Implements functionality that runs on the server
Game logic handling
LocalScript
Implements functionality that runs on the client
Camera handling, GUI management
ModuleScript
A script used to structure and separate common functionality for reusability
Implementing monster classes
Scripts can be created in various locations such as Workspace or ReplicatedStorage from the Level Browser. Depending on the type of script and its placement, its purpose and execution availability can vary.
To efficiently manage the functions of scripts, each location is used for the following purposes:
ReplicatedStorage
Space for objects replicated between the server and client (Example: ModuleScript)
ModuleScript
ServerScriptService
Space for functionality related to the server (Example: ServerGameLogic)
Script ModuleScript
ServerStorage
Space for server objects that do not need immediate replication (Example: GunBullet)
Script
ModuleScript
StarterGui
Space for controlling GUI on the client (Example: PlayerHUD)
LocalScript ModuleScript
StarterPlayer.
StarterCharacterScripts
Space for scripts that run on the client when the character spawns (Example: FirstPersonView)
LocalScript ModuleScript
StarterPlayer.
StarterPlayerScripts
Space for scripts that run on the client when the player enters (Example: InputHandler)
LocalScript ModuleScript
Workspace
Space for objects placed in the world (Example: CheckPoint)
Script ModuleScript
When a player enters and the world is created, the server loads and executes Scripts placed in ServerScriptService and Workspace.
Execution order: ServerScriptService ➡ Workspace
This order ensures that server scripts initialize first, and any global settings or object management tasks for the world are prioritized.
When a client connects to the world, it copies and loads the LocalScripts placed in StarterGui, StarterPlayerScripts, and StarterCharacterScripts to the client and then executes them.
Execution order : StarterGui ➡ StarterPlayerScripts ➡ StarterCharacterScripts
This order initializes UI and player-related settings and logic, preparing the client for interaction with the game.
ModuleScripts can be called on both the server and the client, and are used to define common functionality or reusable code in Scripts or LocalScripts.
Modules are executed when they are called explicitly (require
). The results are cached upon the first call, and subsequent calls return the same value, which enhances execution efficiency and ensures consistency.
Execution order (Server) : Called location (e.g., Workspace, ServerStorage) ➡ ModuleScript location
A Script can call a ModuleScript that handles the global logic or server data of the game.
Execution order (Client): Called location (e.g., StarterPlayerScripts) ➡ ModuleScript location
A LocalScript can call a ModuleScript that handles UI or player-related functionality.
💡 Tip. If a ModuleScript is placed in ReplicatedStorage, it can be called by both the server and the client, making it useful for implementing common logic.
The script functions provided in OVERDARE Studio are all organized in the API Reference. If you are writing scripts and find yourself unsure about the usage or functionality of properties, functions, or events, the API Reference can help you quickly find the necessary information.
For example, if you are unsure about what the PlayerAdded
event is and how it works in a script, you can check the API Reference to understand its role and how it operates. The API Reference includes descriptions, usage instructions, and related examples, making it a valuable tool for writing and debugging scripts.
Using the API Reference allows you to write your code more accurately and efficiently, and also gain a deeper understanding of the script functions.