Bpm tapper in roblox

I need help making a bpm tapper in roblox the only formula ive found so far is beatcount / elapsed time which i assume is beat count for every press / time that passed from each press

local ticksave = 0

local beatscount = 0

script.Parent.GUI.PANEL.BPM.MouseButton1Click:Connect(function()
	ticksave = tick()
	
end)

while wait() do
	local thingja = tick() - ticksave
	local thing = math.round(1/thingja)
	local bpm = beatscount / thing
	script.Parent.GUI.PANEL.BPM.Text = math.round(bpm)	
end

EDIT: notice this script doesnt work

anybody avaliable to help because i really need it

Something like this should work

-- Variables to store the current beat count and elapsed time
local beatCount = 0
local elapsedTime = 0

-- Function to handle the user tapping
local function onTapped()
    beatCount = beatCount + 1
    elapsedTime = 0
end

-- Connect the function to the "tap" event
game.Players.LocalPlayer.Mouse.Button1Down:Connect(onTapped)

-- Main loop to update the elapsed time and calculate BPM
while true do
   task.wait(0.01)
    elapsedTime = elapsedTime + 0.01
    local bpm = (beatCount / elapsedTime) * 60
    print(bpm)
end

It works thank you so much i was up late last night trying to get some help for it

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