#Autoloads not working when exported

1 messages · Page 1 of 1 (latest)

past plume
#

While some things work in my main Global script such as the transition animation and variables, when I export my game to web/itch it just bugs out. Things don't work proper such as the music stop/start function in the script not working, the WorldEnvironment having too much bloom/glow, even when glow is disabled, or code just not working (I.E.: If HP is below MaxHP, it should be equal to 0, but doesn't)

All these problems don't exist in the engine, and only when I export the game.

(1st image is how it is supposed to look. 2nd image is when exported to itch)

#
extends Node


var death : bool = false
var corePos
var xpAmount : float = 0.0
var xpMax : float = 100.0
var gameOver
var score = 0
var coreHealth = 6
var coreMax = 6
var levelNext = 1
var levelCurrent = 0
var paused = false
var playerSpeed = .15
var menu
var whitelistTime = 0

var ability1
var ability2
var ability3
var ability4
var whitelistButton

#Upgrades
var coreRegen = 0
var xpMult = 0.0
var speedMult = 0.0
var virusKaboom = false
var modulePicked = false
var whitelist = false

#Active Upgrades
var whitelistReady = false
var whitelistActive

func _process(delta: float) -> void:
    whitelistTime = $WhitelistCooldown.time_left
    xpAmount = round(xpAmount)
    xpMax = round(xpMax)
    
    if(xpAmount < 0):
        xpAmount = 0
    
    if(Input.is_action_just_pressed("Paused") and !menu):
        playTrans()
        $TransTimer.start()
    
    if(paused):
        $WhitelistCooldown.paused = true
        $WhitelistDuration.paused = true
    elif(!paused):
        $WhitelistCooldown.paused = false
        $WhitelistDuration.paused = false
    
    if(Input.is_action_just_pressed("Dev") and !paused):
        paused = true
    elif(Input.is_action_just_pressed("Dev") and paused):
        paused = false
    
    if(whitelistButton == null):
        return
    else:
        if(Input.is_action_just_pressed(whitelistButton) and whitelist and whitelistReady and !paused):
            $WhitelistCooldown.start()
            $WhitelistDuration.start()
            whitelistActive = true
            whitelistReady = false
            print("Activated")

    if(paused):
        $RegenTimer.paused = true 
    elif(!paused):
        $RegenTimer.paused = false 
    
    
    if(coreHealth > coreMax):
        coreHealth = coreMax
    if(coreHealth < 0):
        coreHealth = 0

func stopMusic():
    $AudioStreamPlayer2D.stop()

func playTrans():
    $TransAnim.play("Trans")
    await($TransAnim.animation_finished)
    $TransAnim.play("RESET")

func startMusic():
    $AudioStreamPlayer2D.play()

func _on_regen_timer_timeout() -> void:
    coreHealth += coreRegen


func _on_trans_timer_timeout() -> void:
    get_tree().change_scene_to_file("res://Scenes/main_menu.tscn")


func _on_whitelist_cooldown_timeout() -> void:
    whitelistReady = true
    print("Cooldown finished")


func _on_whitelist_duration_timeout() -> void:
    whitelistActive = false
    print("Duration finished")```
#

Ignore how messy it is, but this is the Global script

past plume
#

Actually I just moved a WorldEnvironment and audio player to the actual scenes instead of the autoload but still am having the same issue without the autoload so I deadass have no clue what's wrong 😭