I am trying to make a BPM-based beat animation system. When BeatModule.Start is invoked, this error shows up. The beat seems to happen even after this error, and the number supplied is definitely NOT a table.

I use the BPM argument to start the beat, and it does some basic calculation to convert the BPM into seconds.
Here’s the erroring code:
function BeatModule.Beat(BPM)
...
wait(60000 / BPM / 1000 * 2)
...
end
Here’s some extra code if it helps:
BeatModule’s start code:
function BeatModule.Start(BPM)
game.ReplicatedStorage.Playing.Value = true
repeat BeatModule.Beat(BPM) until game.ReplicatedStorage.Playing.Value == false
end
Invoking BeatModule.Start:
self.Modules.BeatModule.Start(150)
I am using AeroGameFramework if anyone’s wondering
Do you ever edit the BPM value inside the function?
No. The only change is the argument being passed into the module function.
You could try printing the BPM
variables inside both your Module Functions perhaps?
Oddly, BeatModule.Start() seems to print this:
table: 0x512f8c6c2587cd0c = {
["Beat"] = "function",
["Start"] = "function",
["_events"] = table: 0x3723507b8e4e8e8c {}
}
The variable seems to become a table at the start, but at some point it becomes what I need the variable to become.
Maybe because it’s returning back the Table inside the ModuleScript? Bit strange that it’s returning back as a Number value
ModuleScripts need at least 1 return value, which is what I am doing here.
I am using this method of making the module, which I don’t know if I’m doing right. Maybe I’m supposed to put BPM inside the module variable??
local BeatModule = {}
function BeatModule.Beat(BPM)
...
end
function BeatModule.Start(BPM)
...
end
return BeatModule
It seems to be returning the module instead of using the variable.