Hi there, I have a script that visualizes a sphere to the music. I have used playbackloudness, the issue is, is that I can’t resize all the dimensions. In this case, the ball scales down to 0.001 and stays like that. It works fine when used on a normal part (cube, etc). Check the last lines.
Thanks!
local part = Instance.new("Part",game.Workspace)
local by = Instance.new("BodyVelocity",part)
local sound = Instance.new("Sound",part)
part.Size = Vector3.new(1,1,1)
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.fromRGB(255, 255, 255)
part.Material = Enum.Material.Neon
part.Shape = Enum.PartType.Ball
part.Anchored = false
part.CanCollide = false
part:SetNetworkOwner(nil)
by.MaxForce = Vector3.new(999999999999,999999999999,999999999999)
by.Velocity = Vector3.new(0,0,0)
sound.Name = "Audio"
sound.SoundId = "rbxassetid://280225750"
sound.Looped = true
sound:Play()
while wait() do
part.Size = Vector3.new(sound.PlaybackLoudness/5, sound.PlaybackLoudness/5, sound.PlaybackLoudness/5);
wait(0.001)
end
Why are you using a BodyVelocity when it’s set to 0,0,0? Is the ball supposed to be moving?
If it isn’t (since you’ve already made it CanCollide false and it won’t react to other Parts in the game) why not just Anchor it?
Are you getting any errors in your Output window when the size gets that low? If the sound.PlaybackLoudness gets to 0 then 0 divided by 5 will probably error.
You could make a simple change like this to make sure that it’s never 0: volume = sound.PlaybackLoudness + .1
Then have:
while wait() do --you could use task.wait()
part.Size = Vector3.new(volume/5, volume/5, volume/5);
--wait(0.001) Wait isn't below 1/60th of a second (.0167) since rendered frame rate is 1/60th of a second. You already have that in your first line of the loop.
end
I wanted the visualizer to be visible for everyone in Void Script Builder, so I used NetworkOwnership however it only works on unachored parts. Also, what do you mean by “But if you don’t make the first line local part then it will be created in the workspace”? It’s already the first line.
Also, I will check if it fixes after the server outage.
Yes, I am aware of that, which is why I added networkOwnership as stated in the script. Please read this comment I posted here.
I wanted the visualizer to be visible for everyone in Void Script Builder, so I used NetworkOwnership however it only works on unachored parts. Also, what do you mean by “But if you don’t make the first line local part then it will be created in the workspace”? It’s already the first line.
Then other players wouldn’t see it. I don’t think you’re getting my point here. I absolutely know that playbackloudness doesn’t work on the server and rather local, which is why I added NetworkOwnership so all players in the server can see it too.
I heard other people trying this too, but I wasn’t sure if you could change the colour and material with a mesh shape. I’ll try it after the server outage is fixed.
Are you 100% sure that is the case. I made something similar and I didn’t need a local script to get the playback loudness. Also, I believe that this works for normal parts except the sphere
OP: You can change MeshParts with Surface appearance. I am pretty sure ypu can change the Material too.
This time, the size shows as “0.002, 0.002, 0.002”. Possibly the “volume” would’ve changed it. The sphere doesn’t move still. I’ll change it to a mesh type.