I'm not asking for a script what so ever, I'm just trying to learn how they work and how I can make one my self.
I'd like to be able to make one using a SurfaceGui and a Part changing size.
I'm not asking for a script what so ever, I'm just trying to learn how they work and how I can make one my self.
I'd like to be able to make one using a SurfaceGui and a Part changing size.
Audio visualizers work by using the PlaybackLoudness property of a sound. One way you could make a vizualizer would be to make a ScreenGui + Frame and set the frame's size every RenderStepped to the PlaybackLoudness of the sound. A script would look something like this
local sound = workspace.Part.Sound
local frame = script.Parent
game:GetService("RunService").RenderStepped:Connect(function()
frame.Size = UDim2.new(1,0,0,sound.PlaybackLoudness/2)
end)
-- you can change the "PlaybackLoudness/2" to anything different (even *2!)
If you wanted it to be a part, then it would get a little complicated because you would have to change the Size and CFrame properties
local part = workspace.Part
local sound = part.Sound
local normCF = part.CFrame
local offset
game:GetService("RunService").RenderStepped:Connect(function()
workspace.Part.CFrame = normCF
offset = sound.PlaybackLoudness/40
workspace.Part.Size = Vector3.new(1,offset,1)
workspace.Part.CFrame = CFrame.new(0,offset/2,0)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
13 comments
Thank you, Would it be the same for a Part using Part.Size?
well in that case, you will change the part's size but also need to change the position at the same time
ALSO, change the UDim2.new to Vector3.new (and use 0, sound.PlaybackLoudness/2, 0)
ok, also as its a function its self does it start doing this on join or can i make run server a variable and do it on something like mouse click or on touch
RunService is, well, a service. If you want it to start on a function then you could put it in a function (make sure there's a debounce so the player doesn't start the function a million times!)
basically script.Parent.MouseButton1Click:Connect(function() The script you provided end) I should be able to do that correct?
Ok sent that before i read that message, Thank you!
I also added the script for if it was a part
I see it can only be ran from a localscript. Where should the localscript go? And will it be the same for all players?
Nvm StarterPlayerScripts
you can also put it in Backpack, StarterGui, StarterPlayerScripts, and StarterCharacterScripts (I think)
Thank you, Also I know i've been asking alot, LIKE ALOT, but is there way I can move the current camera to the audio as well? Sorta like shaking it
I should be good using the audio to move the screen, but I don't know how the move the screen camera in the first place