MyCustomMusic not working (pls HELP!!!)

Loam803

Newbie
Nov 14, 2025
5
0
80
It won't work pls help
-- File: main.lua

-- Load the custom audio stream from the 'sound' folder within the mod
local custom_castle_music = audio_stream_load("sound/Tomorrow's Nostalgia Today.mp3")

-- Check if the music loaded successfully
if (custom_castle_music == nil) then
print("Error: Could not load sound/Tomorrow's Nostalgia Today.mp3. Check file path and format.")
return -- Stop script execution if the file isn't found
end

-- Function that runs every time the player warps (changes levels)
function on_warp()
-- Get the current level ID using the original function
local current_level_id = level_get_id() -- *** Reverted to the original function ***

-- ID 1 is the Peach's Castle level (LEVEL_CASTLE)
if (current_level_id == 1) then
-- Play the custom music. Args: (stream_id, loop, volume)
audio_stream_play(custom_castle_music, true, 1.0)
else
-- Stop the custom music if we leave the castle level
audio_stream_stop(custom_castle_music)
end
end

-- Hook the on_warp function to the game's HOOK_ON_WARP event
hook_event(HOOK_ON_WARP, on_warp)
 

Users who are viewing this thread