Why is my audio visiualizer not working?

Hi, I am a beginner scripter and I am making an audio visualizer for my game. However, my script is not working, and the audio visualizer doesn’t even show up!
Here is my studio:
Screen Shot 2021-04-22 at 10.48.43 AM
Any help?

1 Like

Would you mind showing the contents of the script so we can see if there are any issues with it?
Judging from the location of the script there would be no reason why its not running other than an issue within the script

Oh, sorry I forgot to paste the code iin :flushed:

local music = script:WaitForChild("Music")

local barsSize = 0.1
local barsAmount = 100

local spectrumStartPos = Vector3.new(84, 38, -160)

local audioSpectrumGroup = Instance.new("Model")
audioSpectrumGroup.Parent = workspace

for i = 0, barsAmount - 1 do

	local bar = Instance.new("Part")

	bar.Size = Vector3.new(barsSize, barsSize, barsSize)
	bar.Position = spectrumStartPos + Vector3.new(i * barsSize, 0, 0)   

	bar.Anchored = true
	bar.CanCollide = false

	bar.Parent = audioSpectrumGroup
end


game:GetService("RunService").RenderStepped:Connect(function()

	local currentLoudness = music.PlaybackLoudness

	for i, audioSpectrumBar in pairs(audioSpectrumGroup:GetChildren()) do

		audioSpectrumBar.Size = Vector3.new(barsSize, currentLoudness/barsAmount + (math.random(-10, 10)/10), barsSize) 

		audioSpectrumBar.Color = Color3.fromRGB(99, 0, math.clamp(currentLoudness, 0, 255))
	end
end)

Works fine for me, maybe change the visualizer’s position to something closer to where the player spawns than 84, 38, -160?

Wow strange… how do I find where the player spawns then?

Try setting spectrumStartPos to Vector3.new(0, 3, 0) if your spawn is in the middle of the world
image

Actually I found the problem was I named the child “sound” and not “music”