Substate Scripting

Substates power overlays like pause, game over, and transition screens. Use HScript for full control or Lua with an override workaround.

HScript

Creating a Substate

Add a .hx script to scripts/substates/ . The filename becomes the submenu identifier.

mods/modName/scripts/substates/MySubMenu.hx
    

Modifying a Substate

  1. Copy the target substate from assets/scripts/substates into your mod’s scripts/substates/ .
  2. Edit the copy; the engine will load yours first.
  3. Use the FPS counter to confirm which submenu is active while testing.

Accessing a Substate

Open a scripted substate from code:

CoolUtil.openSubState(new CustomSubState('ScriptName'));
    

Lua

Creating a Substate

Place a .lua script under scripts/substates/ :

mods/modName/scripts/substates/MySubMenu.lua
    

Modifying a Substate

Base substates are written in HScript. To override them with Lua, pair your Lua script with an empty .hx file of the same name so both run together.

Accessing a Substate

Use the Lua helper to open a submenu:

openSubState('funkin.substates.CustomSubState', {'ScriptName'})
    

Developer Notes

Written by Malloy Last updated: Nov 20, 2025 Edit
ALE Psych [Rewritten] · Created by Alejo GD Official and THE VOID · Website by ImMalloy