Sound.PlaybackVolume keeps returning zero

Im trying to make a sound vizualizer thing but the volume keeps returning 0
The sound is in a humanoid root part and the script is a server script

soundInstance.Playing = true
hum.AutoRotate = false
for count = 1,360,20 do
	task.wait(0.2)
	local part = Instance.new("Part",workspace)
	part.CFrame = hrp.CFrame
	part.Anchored = false
	part.Size = Vector3.new(1,15,1)
	part.Position += Vector3.new(0,2,0)
	part.CanCollide = false
	part.Orientation += Vector3.new(0,count,0)
	part.CFrame += part.CFrame.LookVector * 5
	part.Material = Enum.Material.Neon
	local weld = Instance.new("WeldConstraint",part)
	weld.Part0 = part
	weld.Part1 = hrp
	task.spawn(function()
		while task.wait() do
			print(soundInstance.PlaybackLoudness)
			local goal = {Size = Vector3.new(1,soundInstance.PlaybackLoudness,1),Color = Color3.fromRGB(-(soundInstance.PlaybackLoudness),-(soundInstance.PlaybackLoudness),-(soundInstance.PlaybackLoudness))}
			local tween = game.TweenService:Create(part,TweenInfo.new(2,Enum.EasingStyle.Quad),goal)
			tween:Play()
			tween.Completed:Wait()
		end
	end)
end
hum.AutoRotate = true

Sound doesn’t play on the server, only on clients, thus PlaybackVolume will always be zero on the server

1 Like

SoundService plays on the server and replicates to all clients.

Have you tried moving your sound object to the workspace and trying it that way? Make sure to define it properly in script when u move it.

If you are creating an instance, then parent it to workspace.

1 Like

I believe @Prototrode is right. Sound.PlaybackLoudness says that PlaybackLoudness is NotReplicated meaning that it’s not replicated across Roblox’s server/client boundary. The sound visualizer would have to be client-sided as shown in the example in the API reference.

2 Likes

Thank you all but the script i was working on didnt save so i cant test ur ideas ;-;