How to make notes spawn before audio starts?

So, for fun I’m recreating a 2019 - Early 2020 version of the game Sound Space, and I’m struggling to get note spawning to work correctly.

As most of the notes do spawn correctly, the notes at the start of a map are always bugged if they appear before SongPosition minus ApproachTime.

Video of issue:

And my current note spawning code, I know it’s bad but idk how else to do it.

	task.spawn(function()
		task.wait(ApproachTime)
		script.MapMusic.Volume = 1
		script.MapMusic:Play()
	end)
	for Index, Value in pairs(MapData) do
		local NoteData = string.split(Value, '|')
		task.spawn(function()
			repeat
				task.wait()
			until script.MapMusic.TimePosition >= tonumber(NoteData[3]/1000) - ApproachTime or not PlayingMap
			if PlayingMap then SpawnNote(NoteData) end
		end)
	end

Thanks for reading and or helping!

2 Likes

Why do you have to separate the the two functions, wouldn’t be easier to make it all in the same function?

Update, got it fixed with one of the worst solutions ever.
Just had a second, silent song playing and used it as an offset.

1 Like

Also, making the spawn note function the same as the map read function makes the games frames drop by 30 (60 > 30) which you of course don’t want on a rhythm game.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.