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

Why music won't play?

Asked by 8 years ago

Hello, I have problem with music gui. When player join to game it showing name of music which should playing, but i don't know why it don't work. Songs id's are fine.

Here is script from ServerScriptService > Random Music script which is main script:

_G["Last"] = {}


local Songs = {
    {179981960, "Avicii - Levels"},
    {190162862, "Avicii - The Nights"},
    {163884149, "Amnesia - 5 seconds of summer"},
    {174421816, "ERA - Ameno"},
    {152473326, "AJR - I'm Ready"},
    {163040671, "Queen - Crazy little thing called love"},
    {178768217, "TheLivingTombstone - Five nights at Freddy's"},
    {158630653, "Queen - Don't stop me now"},
    {151710009, "Frozen - Let it go"},
    {204128593, "Billy Joel - Piano Man!"}
}

repeat wait() until _G["Last"]

local Notice = script:WaitForChild("Notice")
local Debounce = false
local Song

if #game.Players:GetChildren() == 1 then wait(3) end

NextSong = function()
    if not Debounce then
        Debounce = true
        repeat wait() Song = Songs[math.random(1, #Songs)] until Song ~= nil and Song[1] ~= _G["Last"].Song -- This makes it so that it doesn't play the same song twice.
        _G["Last"].Song = Song[1]
        local Music = Instance.new("Sound",workspace)
        Music.Name = Song[2]
        Music.SoundId = "http://www.roblox.com/asset/?id="..Song[1]
        Music:Play()
        Notice.Value = ("Song Playing : "..Song[2])
        wait(Music.TimeLength)
        Music.Volume = 0
        repeat
            Music:Stop()
            wait()
        until Music.IsPlaying == false
        Music:remove()
        wait()
        NextSong()
        Debounce = false
    end
end
NextSong()

Here is script from Random Music GUI:

local Random_Music = workspace:FindFirstChild("Random Music") or game.ServerScriptService:FindFirstChild("Random Music")
local String = Random_Music:WaitForChild("Notice")
local Main = script.Parent
local Notice = script.Parent:WaitForChild("Notice")
local Shadow = Notice.Shadow

local debounce = false

local Anim = {}
    Anim.Duration = 0.4
    Anim.Type = "Sine"

local Update = function()
    if not debounce then
        debounce = true
        Main:TweenPosition(UDim2.new(0.3,0,Main.Position.Y.Scale,0), "Out", Anim.Type, Anim.Duration, true)
        Notice.Text = String.Value
        Shadow.Text = String.Value

        wait(4)

        Main:TweenPosition(UDim2.new(1.43,0,Main.Position.Y.Scale,0), "Out", Anim.Type, Anim.Duration, true)
        wait(Anim.Duration)
        Notice.Text = "" -- Not needed :P
        Shadow.Text = "" -- Also not needed, but why not? :P
        Main.Position = UDim2.new(-0.43,0,Main.Position.Y.Scale,0)
        debounce = false
    end
end

String.Changed:connect(Update)

It's not my script... Made by acecateer. Here is link: http://www.roblox.com/item.aspx?seoname=Random-Music-system-With-GUI-Broken&id=212028418

1 answer

Log in to vote
0
Answered by
Rhyxus 0
8 years ago

Do you have the local script that's in the lightning? if you don't create a local script put it in the lighting and put this in it.

game.workspace.sound:play()
0
Still don't work. DevKarolus1 70 — 8y
Ad

Answer this question