ROBLOX LUA SCRIPING NOTES
Main Core Features of Prototype “Erda”
Spaceship-Central hub situated in outer space with a glass panel
overlooking Earth as it changes over time via an onboard time machine.
A “game start system” that has the player enter a small capsule that is
then shot into the earth from the spaceship, entering its atmosphere and
smashing into the ground. (Helldivers style spawn)
A spacesuit for the player that allows them to survive the early
environments of Earth (e.g., Hadean, Archean, Proterozoic, Permian
Period…)
An in-game object scanner tool/system that logs specific
objects/lifeforms/flora and fauna into an in-game accessible
logbook/journal. (The main objective of the game is to log as many flora and
fauna as you can as you span the different eons of the Earth.)
Different interactable entities and mobs that can be scanned and logged by
the player, which are both possibly hostile/neutral/passive, depending on
the species.
Dynamic player environments?
A form of self-defense against the potential hostile entities of ancient
Earth.
A drag-click system for unanchored objects
Possible Over the Shoulder style camera
An inventory system?
A progression system that requires the player to meet the quota of
researched/logged entities to progress to the next period on the geological
timescale.
Pathfinding system for Hostile entities
Friendly Pathfinding system for Dina, the game mascot and companion.
(Dina possibly works like BD-1 from JEDI: Fallen Order.)
A recall system that lets the player return to the ship that is within orbit.
My game design skeleton is: An Exploration Sandbox. The player is spawned into a
spaceship within the orbit of a desolate, lifeless Earth, where the player is tasked to
go back in time with a fictional time machine onboard the spaceship to find out
where it all went wrong. This journey spans the entirety of the Earth's life on the
Geologic Timescale as the player has to go "boots on the ground" and traverse all of
the periods of Earth up until the first appearance of Humans.
Gameplay loop: Spawn - Pick Time period - Explore and log present entities,
flora/fauna/objects/lifeforms - return to the ship - progress to the next time period on
the geologic timescale.
Authoritative States Data that exists: Player Health Collection of entities logged
within the journal/logbook Number of time periods unlocked through progression UI
displays that display the current time period, temperature, and time.
Mental Model-Oriented List of Core Luau Code Concepts
Variables – State Holders
Mental Model – A labeled box that contains a value inside.
Core uses
Store user input
Track game state (health, score, mode)
Hold intermediate results
Remember choices
local health = 100
local operator = "+"
local result = 42
Functions – A machine that transforms input into output or
performs an action.
Mental Model – A Transistor/Machine that processes inputs into
outputs.
Core uses
Encapsulate logic
Reuse calculations
Organize code
Abstract complexity
local function Add(a, b)
return a + b
end
Parameters – Inputs utilized for Functions
Mental model - Input ports on a machine.
Core uses
Pass values into logic
Make functions reusable
Avoid hardcoding
Add(5, 10)
Return – Output Channel/To send data back.
Mental model - The output chute of a machine.
Core uses
Produce results
Control flow (early exit)
Define module exports
return result
if / elseif / else — Decision Gates/ Control whether code is
allowed to execute.
Mental model - Logical gates that open or close.
Core uses
Validation
Permissions
State checks
Branching logic
if health <= 0 then
return
end
Boolean values (true/false) — Signals/Represent yes/no, on/off,
allowed/blocked.
Mental model - Electrical signals.
Core uses
Condition results
Feature/Settings toggles
State flags
local isAlive = true
Operators (+, -, ==, and, or) — Logic & Math Tools/ Operate on
values to produce new ones.
Mental model - Mathematical or logical processors.
Core uses
Math calculations
Comparisons
Compound conditions
if a > 0 and b < 10 then…
Tables — Containers / Records/ Tables group related data
together.
Mental model - A box containing labeled or ordered slots.
Core uses
Lists
Dictionaries
Objects
State storage
local playerData = {
score = 0,
level = 1
}
Loops (for, while) — Repeaters/Repeat logic over time or over
data.
Mental model - Conveyor belts.
Core uses
Process lists
Poll conditions
Apply logic to many objects
for _, player in ipairs(players) do
Events (:Connect) — Triggers/ React to something happening.
Mental model - Alarm systems or buttons.
Core uses
User input
Game events
State changes
[Link]:Connect(function(player)
Scope (local) — Visibility Rules/ Controls where data is allowed
to exist.
Mental model - Room access permissions.
Core uses
Prevent conflicts
Limit side effects
Improve safety
local result = 5
Modules — Libraries / Toolkits/ Group related logic for reuse.
Mental model - A toolbox you can hand to other scripts.
Core uses
Share functions
Organize large projects
Separate concerns
return Module
Nil — Absence/ Represents “nothing exists here.”
Mental model - An empty slot.
Core uses
Missing data
Reset state
Check existence
if value == nil then
Big-picture mapping (important)
Fundamental
Concept
Role
Variable Memory
Functio Transformatio
n n
Parame
Input
ter
Return Output
If Gate
Fundamental
Concept
Role
Loop Repetition
Event Trigger
Table Structure
Boolean Signal
Module Organization
Basic Object Referencing
[Link] = 0.5
Basic Roblox Data-types
1. Text or String – (“Sample Text”)
2. Number – 3020
3. Boolean – True/False
4. Object reference – [Link]…
Additional Data-types
1. nil – N/A or No value
Basic Variable Usage
Setting a variable - local Diceshortcut = [Link].dice1.
Utilizing a variable - [Link] = [Link](“Really blue”)
local text = “Blah blah blah”
print(text)
The output will be: Blah blah blah
Because the script recognizes text as a variable that is set with the data
type of “Blah blah blah”.
You can also do mathematics through setting your variables as numbers
and performing operations like +,-,*,/.
The word variable means being able to change at any time like a countdown
timer, subtracting 1 to a number every second until it reaches 0.
On the 3rd line of the script, we could change “50” in the script into
something that is player-influenced. Imagine if 500 and 10 is a fixed
unchangeable number and whatever you replace 50 with is something the player
can change himself, showing the real dynamics of variables.
Basic Instancing
Instancing – Allows you to insert things into your game through a script. To insert
things at a specific time or from storage.
[Link](“Part, [Link]”) – Inserts a part into your workspace.
Some uses for instancing through variables:
local greenring = [Link].
[Link](“Part, greenring”)
- Maybe this could work?
local MyPart = [Link](“Part, [Link]”)
MyPart .Transparency = 0.5
[Link] = true
[Link] = [Link](5,5,5)
- Since instancing is limited to only inserting parts and stating their location in the
gamespace, we need to resort to the usage of variables to be able to transform its
different properties all the while inserting it into the stated directory location.
- The usage of “[Link]” is bad practice in scripting.
local MyPart = [Link](“Part”)
MyPart .Transparency = 0.5
[Link] = true
[Link] = [Link](5,5,5)
[Link] = [Link]
- This is a cleaner, more efficient approach to scripting this problem.
How to use Functions
- A defined piece of code that can be called upon with a name.
function generatePart()
-place any code you want to be ran in this area when function is called.
End
generatePart() – Is used to call the function
How to use Parameters