Ad
Log in to vote
0

I'm currently fixing an audio visualizer and have no idea why it is not working?

Asked by 15 days ago
local part = workspace:FindFirstChild("Set") -- Part which will be visualised
local sizex = part.Size.X -- Unnecessary if using a fixed value for sizex
local sizez = part.Size.Z -- Unnecessary if using a fixed value for sizey
local positiony = part.Position.Y -- Unnecessary if using a fixed value for positiony
local positionx = part.Position.X -- Unnecessary if using a fixed value for positionx
local positionz = part.Position.Z -- Unnecessary if using a fixed value for positionz
local sound = workspace.Music -- Referring the sound which will be visualised

game:GetService("RunService").RenderStepped:Connect(function()
    local loudness  =  sound.PlaybackLoudness -- Obtains the playback loudness of the sound
    local sizeincrement = loudness/60 -- The Number can be edited, depending on how you want it to behave.
    for i,v in pairs(part:GetChildren()) do
        if v then
            v.Size = Vector3.new(sizex,sizeincrement,sizez)
            v.Position = Vector3.new(positionx,positiony+(sizeincrement/2),positionz)
        end
    end

    --part.Size = Vector3.new(sizex, sizeincrement, sizez)
    --part.Position = Vector3.new(positionx, positiony + (sizeincrement/2), positionz) -- Line unnecessary if you want the part to grow on both sides equally.
    -- sizeincrement can be switched to any axis depending on how you want the part to grow (it should be on the same axis as the size line and position line to work dependently)
end)
0
and yes Set is a MODEL but it has parts inside which I what I'm doing. JerkDerekThe14alt 11 — 15d

Answer this question