New audio analyzer not working

So I have a local script that creates an AudioDeviceInput to the player’s mic and then connect it to a audio analyzer on the character but for some reason the audio analyzer’s RmsLevel dosen’t change

here is the code

local players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local plr = players.LocalPlayer
local JumpActivated = ReplicatedStorage:WaitForChild("RemoteEvents"):WaitForChild("Talk")

local input = Instance.new("AudioDeviceInput", plr)
input.Name = "MicrophoneInput"
input.Player = plr


local function connect(src: Instance, dst: Instance)
	local wire = Instance.new("Wire", dst)
	wire.SourceInstance = src
	wire.TargetInstance = dst
end


local function OnCharacterSpawned(player: Player, character: Model)
	local analyzer = Instance.new("AudioAnalyzer", character)
	connect(input, analyzer)
	
	local debounce = false
	local running = true

	local function onAncestryChanged(_, parent)
		if not parent then
			running = false
		end
	end
	
	character.AncestryChanged:Connect(onAncestryChanged)

	 coroutine.wrap(function()
		while running do

			if not debounce and analyzer.RmsLevel > 0.015 then
				debounce = true
				JumpActivated:FireServer()
				task.delay(0.1, function()
					debounce = false
				end)
			end
			task.wait(0.1)
		end
	end)()
end


local function onCharacterAdded(character)
	OnCharacterSpawned(plr, character)
end

if plr.Character then
	onCharacterAdded(plr.Character)
end

plr.CharacterAdded:Connect(onCharacterAdded)
2 Likes

You could just put this in Startercharacterscripts and then you wouldn’t have to do all of those OnCharacterSpawned functions because the Character will always be script.Parent

I actually copied this code from youtube because I checked how to do this and I also changed it believe me it was worse before lol anyways do you know why this dosen’t work?

Can you share the YouTube video?

yep https://www.youtube.com/watch?v=1KyNScXxvac the model is in the description

I think the audio analyser needs to be parented to the input.

I tried it and it dosen’t make a difference

Looks the same to me but it worked for the dude in the vid. Any errors in the console?

There are no errors in the console

So the RmsLevel is 0 but the PeakLevel changes?

I checked and Both are at 0 this is really weird

Is your mic working? Check on discord or smth

it does I also checked this in the roblox player and my mic was working