Reverse Single Script Architecture (RSSA)
Takes Single Script Architecture (SSA) and does the complete opposite
RSSA allows normal Scripts and LocalScripts to behave like modules that return values, while using a single ModuleScript as the core of the game.
This is done using two global functions:
_G.Load(script)
_G.Return(value)
How RSSA works
_G.Load(script)
- Clones the given Script/LocalScript
- Runs it inside a designated “Active” folder
- Waits until the script calls
_G.Return(value) - Returns that value synchronously
_G.Return(value)
- Called inside a loaded script
- Uses
debug.info(2, "s")to identify the caller - Sends a value back to the loader
- Works for tables, strings, numbers — anything
No coroutines, no BindableEvents, no other ModuleScripts
Everything is done using Roblox’s existing script runner + a bit of debug metadata.
It’s cursed, but cleanly implemented
RSSA is meant as a fun experiment, but the code is strict-typed Luau, uses clear paths, and works identically on server and client.
Folder Structure
You need two folders on each side:
Server
ServerScriptService
Storage → contains template Scripts
Active → clones get parented here
Client
PlayerScripts
Storage → contains template LocalScripts
Active → clones get parented here
The Core RSSA Runtime
Click to expand full Core code
--!strict
--[[
RSSA Core (Reverse Single Script Architecture)
Allows normal Scripts/LocalScripts to behave like synchronous modules.
]]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
type Side = "Server" | "Client"
local Environment: Side = RunService:IsServer() and "Server" or "Client"
local Storage: Instance
local Active: Instance
type ReturnMap = {[string]: any}
local Returns: ReturnMap = {}
function _G.Return(Value: any)
local key: string = debug.info(2, "s")
Returns[key] = Value or {}
end
function _G.Load(Script: Script | LocalScript): any
local Loaded: Script | LocalScript = Script:Clone()
Loaded.Parent = Active
Loaded.Enabled = true
local Key: string = Loaded:GetFullName()
repeat task.wait() until Returns[Key]
local result: any = Returns[Key]
Returns[Key] = nil
return result
end
local Load = _G.Load
-------------------------------------------------------------------------------
-- SERVER EXAMPLES
-------------------------------------------------------------------------------
if Environment == "Server" then
warn("Server Running")
local ServerScriptService = game.ServerScriptService
Storage = ServerScriptService.Storage
Active = ServerScriptService.Active
print(Load(Storage.HelloWorld))
local waited = Load(Storage.WaitExample)
print("WaitExample:", waited.Message, waited.Time)
local mathResult = Load(Storage.MathTask)
print("MathTask:", mathResult.Sum, mathResult.Product, mathResult.Average)
local serverInfo = Load(Storage.ServerInfo)
print("ServerInfo:", serverInfo.JobId, serverInfo.PlayerCount)
local chain = Load(Storage.ChainMaster)
print("ChainMaster Math:", chain.Math.Sum)
print("ChainMaster Wait:", chain.Wait.Message)
-------------------------------------------------------------------------------
-- CLIENT EXAMPLES
-------------------------------------------------------------------------------
else
warn("Client Running")
local Player = game.Players.LocalPlayer :: Player
local PlayerScripts = Player.PlayerScripts
Storage = PlayerScripts.Storage
Active = PlayerScripts.Active
local who = Load(Storage.WhoAmI)
print("WhoAmI:", who.Name, who.Display)
print(Load(Storage.Debug))
local numbers = Load(Storage.Numbers)
print("Numbers sum:", numbers.Value1 + numbers.Value2)
local info = Load(Storage.ClientInfo)
print("ClientInfo:", info.Player, info.CameraPosition)
end
return nil
Example Scripts (Server)
Place these inside ServerScriptService.Storage
HelloWorld
--!strict
local Return = _G.Return
Return("Hello from the server!")
WaitExample
--!strict
local Return = _G.Return
task.wait(2)
Return({ Message = "Finished waiting 2 seconds", Time = os.time() })
MathTask
--!strict
local Return = _G.Return
local a, b = 14, 28
Return({ Sum = a+b, Product = a*b, Average = (a+b)/2 })
ServerInfo
--!strict
local Return = _G.Return
Return({
JobId = game.JobId,
PlayerCount = #game.Players:GetPlayers(),
Time = os.time(),
})
ChainMaster (Loading in a Loaded Script)
--!strict
local Load = _G.Load
local Return = _G.Return
local s = script.Parent
local mathResult = Load(s.MathTask)
local waitResult = Load(s.WaitExample)
Return({
Math = mathResult,
Wait = waitResult,
})
Example Scripts (Client)
Place inside PlayerScripts.Storage
WhoAmI
--!strict
local Return = _G.Return
local p = game.Players.LocalPlayer
Return({ Name = p.Name, Display = p.DisplayName, UserId = p.UserId })
Debug
--!strict
local Return = _G.Return
Return("Debug LocalScript ran successfully.")
Numbers
--!strict
local Return = _G.Return
Return({ Value1 = 12, Value2 = 34 })
ClientInfo
--!strict
local Return = _G.Return
local cam = workspace.CurrentCamera
local p = game.Players.LocalPlayer
Return({
Player = p.Name,
CameraPosition = cam and cam.CFrame.Position or Vector3.zero,
})
Warning
RSSA was created to test the bounds of Roblox, it was not designed to be a production system.
It:
- yields until a script returns (Always return something)
- uses global state
- uses debug metadata
But it does work surprisingly well and is great for learning, experimentation.
Conclusion
This was made for fun, but it demonstrates:
- Luau’s script identity system
- how
debug.infoworks - creative ways to manipulate Roblox’s script runner
- how far you can push non-ModuleScript architectures
If you build your own systems using RSSA, feel free to share them.
Credits
- hank_hail — Developer
- ratplier — Contributor
- 1kaelen1 — Contributor
- apoiiya — Contributor

