From 38d2a767aa18f142ab85dee630783617747b80ea Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Thu, 10 Nov 2022 15:54:34 +0100 Subject: [PATCH] Update MusicBeatState.hx --- source/funkin/system/MusicBeatState.hx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/funkin/system/MusicBeatState.hx b/source/funkin/system/MusicBeatState.hx index cafeb698..5ed375ed 100644 --- a/source/funkin/system/MusicBeatState.hx +++ b/source/funkin/system/MusicBeatState.hx @@ -81,12 +81,16 @@ class MusicBeatState extends FlxUIState implements IBeatReceiver function loadScript() { if (scriptsAllowed) { - var className = Type.getClassName(Type.getClass(this)); - var scriptName = className.substr(className.lastIndexOf(".")+1); - - stateScript = Script.create(Paths.script('data/states/${scriptName}')); - stateScript.setParent(this); - stateScript.load(); + if (stateScript == null || stateScript is DummyScript) { + var className = Type.getClassName(Type.getClass(this)); + var scriptName = className.substr(className.lastIndexOf(".")+1); + + stateScript = Script.create(Paths.script('data/states/${scriptName}')); + stateScript.setParent(this); + stateScript.load(); + } else { + stateScript.reload(); + } } } override function create()