Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Music visualizer doesn't work in server ?

Asked by
LeadRDRK 437 Moderation Voter
7 years ago
Edited 7 years ago

This is a server script that controls the visualizer. It works in studio, but in a server it only plays the music. Help ?

local visualizer = script.Parent.Parent
local div = script.base_divisor.Value
local song = nil
local songInfoGui = visualizer.box.songPlaying.SurfaceGui

function pickSong()
    math.randomseed(tick()*math.random()) math.random()
    song = visualizer.list.emit:GetChildren()[math.random(#visualizer.list.emit:GetChildren())]
end

function main()
    pickSong()
    song:Play()
    local Asset = game:GetService("MarketplaceService"):GetProductInfo(string.sub(song.SoundId, 14))
    songInfoGui.songName.Text = "Playing : " .. Asset.Name
    while song.Playing do
        songInfoGui.songTime.Text = math.floor(song.TimeLength - song.TimePosition)
        for _, part in pairs(visualizer.p:GetChildren()) do
            local PartPosition = part.Position
            part.Size = Vector3.new(part.Size.X, (song.PlaybackLoudness/div)/(part.num.Value), part.Size.Z)
            part.CFrame = CFrame.new(PartPosition)
            part.Color = Color3.fromHSV(part.Size.Y*2,part.Size.Y*2,part.Size.Y*2)
        end
        wait()
    end
    main()
end

main()
0
You will need to use the run service for this kind of task. User#5423 17 — 7y
0
How do you do that ? If you know how to, post the fixed version of the script please. LeadRDRK 437 — 7y

Answer this question