BPM Waiting Function

I’m making a rhythm game and I want BPM waiting. No, I don’t wanna use PlaybackLoudness because I also want it to determine note timing.

BPM as in beats per minute? You gotta be more specific. If you’re talking about something like Osu, then do the total beat, and divide it by the amount of minutes, or you can do Beats * 60 / (Minutes * 60+Seconds)

Here’s something I do when making rythm games:

Let’s say the Tempo is 120 BPM.

That means, that a single beat is a Minute/BPM
So 60/120, a single beat is half a second.

local tempo = 120 --120 beats per minute.
local finished = true

repeat
	wait(60/tempo) --Wait a single beat
	--Your game logic
until finished == true

That’ll repeat waiting the beat and generating notes or whatever your game logic is.

Keep in mind that wait() is not a very accurate function.
I usually use an alternative with RunService.Heartbeat.

To make different beat lengths, just multiply the Minute/BPM by the length.

Example:
0.5 * Minute/BPM = half beat

2 * Minute/BPM = 2 beats.

3 Likes

Thank you very much! I appreciate it.