Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How Would i Make a Trello Music Player?

heres the script

script.parent.:GetFirstChile
script.parent:Connect
script.parent:Board ID = pdXEwjTo
script.parent:API = f4fa5843da12d4523ff3bbe4d0bc4906
script.parent:Token =   9153402d16c38234673f1f623c88c544f456905ad7125e5d067870c438dc1258

2 comments

0

this looks like garbage

0

question mark question mark question mark question mark question mark question mark question mark question mark question mark question mark

2 answers

While I don't know how you would do it, here are some changes to help with the program.

script.parent:GetFirstChile()
script.parent:Connect()
script.parent:Board ID = "pdXEwjTo"
script.parent:API = "f4fa5843da12d4523ff3bbe4d0bc4906"
script.parent:Token = "9153402d16c38234673f1f623c88c544f456905ad7125e5d067870c438dc1258"

1 comment

0

Please try and check your answers (test it in command bar, script, etc).

You'd have to get a list in a specific Trello board. The you'd have to collect all the cards inside the specific list, these cards being sound IDs. After you've got all the sound IDs you'd put them into a table and play them..

From this script it doesn't seem you have alot of scripting knowledge.. so I'm going to make it easier for you..

Free Trello Music Player: https://www.roblox.com/library/443538577/Music-System-fixed-again Here's the main script as well lol..

local productId = 30121493
local trelloboard = "jqjkt22Y"
local trellokey = ""
local trellotoken = ""
local Group = 1227426 
local RequiredRank = 14 --Rank that can skip songs
local skipratio = 0.35

local songs = {}
local nowplaying = nil
local requests = {
}
local http = game:GetService('HttpService')
local lists = http:JSONDecode(http:GetAsync("https://api.trello.com/1/boards/"..trelloboard.."/lists?key="..trellokey.."&token="..trellotoken))
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?key="..trellokey.."&token="..trellotoken))
		for _,v in pairs(items) do
			if v.name:match(":") ~= nil then
				local s,f = string.find(v.name,":")
				warn(string.sub(v.name,f+1))
				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()
	if nowplaying then
		return game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name
	else
		return nil
	end
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("speaker"):WaitForChild("Sound"):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.speaker.Sound.SoundId = "rbxassetid://"..thisfunctionssong
	wait()
	Workspace.speaker.Sound:Play()
	game.ReplicatedStorage.musicEvents.newSong:FireAllClients(game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name)
	votes = {}
	wait(120)
	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 <= skipratio 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)


game.Players.PlayerAdded:connect(function(Player)
	Player.Chatted:connect(function(msg)
		if Player:GetRankInGroup(Group) >= RequiredRank then
			if msg == 'skipsong'or msg == 'skip song' or msg == 'skip' then
				makesong()
			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)
				return Enum.ProductPurchaseDecision.PurchaseGranted
            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()

This discussion is preserved as it was. New answers, comments, and votes are closed.