I am currently using a script made by wizzy001 that plays music and has a synced gui that displays the song name. I have changed this up quite a bit and have been trying to add a certain feature to this script. I would like to add the feature of having the song name display on a Surface gui aswell as the screen gui. I have tried 3 times with different methods of trying to accomplish this but each time has been rendered useless. I am hoping somebody can help me although this seems to be more of a longer script I've seen on here. If possible can somebody add the ability to have multiple surface guis displaying the song? For example have one big tv with the song displaying and then a couple smaller tv's with the song displaying. Thank you.
local productId = 26059960 --your dev product for a song
local trelloboard = "yOFBQk6X" -- The id of numbers and letters in the Url. For example https://trello.com/b/h3ORMmQR/music "h3ORMmQR" would be the id.
local songs = {}
-- do not touch anything below or I will cry ~Wiz --
local nowplaying = ""
local requests = {
}
local http = game:GetService('HttpService')
local lists = http:JSONDecode(http:GetAsync("https://api.trello.com/1/boards/"..trelloboard.."/lists"))
for _,v in pairs(lists) do
if v.name == "Music List" then
local items = http:JSONDecode(http:GetAsync("https://api.trello.com/1/lists/"..v.id.."/cards"))
print(#items)
for _,v in pairs(items) do
if v.name:match(":") ~= nil then
local s,f = string.find(v.name,":")
table.insert(songs, string.sub(v.name,f+1))
end
end
end
end
function shuffleTable(t)
math.randomseed(tick())
assert(t, "shuffleTable() expected a table, got nil" )
local iterations = #t
local j
for i = iterations, 2, -1 do
j = math.random(i)
t[i], t[j] = t[j], t[i]
end
end
shuffleTable(songs)
local songnum = 0
function game.ReplicatedStorage.musicEvents.getSong.OnServerInvoke()
return game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name
end
game.ReplicatedStorage.musicEvents.purchaseSong.OnServerEvent:connect(function(p)
if p.userId > 0 then
game:GetService("MarketplaceService"):PromptProductPurchase(p, productId)
end
end)
local votes = {
}
function makesong()
workspace:WaitForChild("TrelloSound"):Stop()
wait()
if #requests == 0 then
songnum = songnum+1
if songnum > #songs then
songnum = 1
end
nowplaying = songs[songnum]
else
nowplaying = requests[1]
table.remove(requests,1)
end
local thisfunctionssong = nowplaying
workspace.TrelloSound.SoundId = "rbxassetid://"..thisfunctionssong
wait()
workspace.TrelloSound:Play()
game.ReplicatedStorage.musicEvents.newSong:FireAllClients(game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name)
votes = {}
workspace:WaitForChild("TrelloSound").Ended:wait(2)
if "rbxassetid://"..nowplaying == "rbxassetid://"..thisfunctionssong then
makesong()
end
end
function countVotes()
local c = 0
for _,v in pairs(votes) do
if v[2] == true then
c = c +1
end
end
local remainder = #game.Players:GetPlayers() - #votes
local percent = (c + (remainder/2))/#game.Players:GetPlayers()
game.ReplicatedStorage.musicEvents.voteChange:FireAllClients(percent)
if percent <= 0.2 then
--skip song
makesong()
end
return
end
game.ReplicatedStorage.musicEvents.voteYes.OnServerEvent:connect(function(p)
for _,v in pairs(votes) do
if v[1] == p.Name then
v[2] = true
countVotes()
return
end
end
table.insert(votes, {p.Name, true})
countVotes()
end)
game.ReplicatedStorage.musicEvents.voteNo.OnServerEvent:connect(function(p)
for _,v in pairs(votes) do
if v[1] == p.Name then
v[2] = false
countVotes()
return
end
end
table.insert(votes, {p.Name, false})
countVotes()
end)
--skip song command
Group = 2888962
RequiredRank = 14
game.Players.PlayerAdded:connect(function(Player)
Player.Chatted:connect(function(msg)
if Player:GetRankInGroup(Group) >= RequiredRank or Player.Name == "Player" or Player.Name == "Crossota" or Player.Name == "TimeFailured" or Player.Name == "railworks2" or Player.Name == "ExploreTheLocal" or Player.Name == "Evelynx3" then
if msg == 'skipsong' or msg == 'SkipSong' then
makesong()
end
end
end)
end)
Group = 2888962
RequiredRank = 14
game.Players.PlayerAdded:connect(function(Player)
Player.Chatted:connect(function(msg)
if Player:GetRankInGroup(Group) >= RequiredRank or Player.Name == "Player" or Player.Name == "Crossota" or Player.Name == "TimeFailured" or Player.Name == "railworks2" or Player.Name == "ExploreTheLocal" or Player.Name == "Evelynx3" then
if msg == ':disable' then
script.Parent.Parent.opt.Song.Text = "System Disabled"
game.Workspace.TrelloSound.Volume = 0
end
end
end)
end)
game:GetService('MarketplaceService').ProcessReceipt = function(details)
for _, player in ipairs(game.Players:GetPlayers()) do
if player.userId == details.PlayerId then
if details.ProductId == productId then
game.ReplicatedStorage.musicEvents.addSong:FireClient(player)
end
end
end
end
game.ReplicatedStorage.musicEvents.addSong.OnServerEvent:connect(function(p,id)
if tonumber(id) ~= nil and game:GetService("MarketplaceService"):GetProductInfo(tonumber(id)).AssetTypeId == 3 then
table.insert(requests, id)
end
end)
makesong()
