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

I am trying to add a command that displays its SongValues as a title on a Screen Gui, help?

Asked by 7 years ago
local looped = false 
local pitch = 1
local volume = 1
local songPlayTime = 120
local nextSongPlayTime = 2


local songValues = {}
local songs = script.Parent:GetChildren()


for i,v in pairs(songs) do
    if v:IsA("IntValue") and v.Name == "MusicId" then
        table.insert(songValues, v.Value)
    end

    local Asset = game:GetService("MarketplaceService"):GetProductInfo(songValues)
game.StarterGui.Currentlyplaying.Frame.TextLabel.Text = ("Now Playing... " .. Asset.Name)


end

local sound = Instance.new("Sound",script.Parent)
sound.Name = "MusicPlayer"



if looped == true then
    sound.Looped = true
else
    sound.Looped = false
end

sound.Pitch = pitch
sound.Volume = volume



while true do
    sound.SoundId = "rbxassetid://"..songValues[math.random(1,#songValues)]
    sound:Play()
    wait(songPlayTime)
    sound:Stop()
    wait(nextSongPlayTime)

end

Answer this question