To be more clear, what I hope to do is make a local gui with local music that stops once the player clicks the button and replays from the begging of the table (musicTable) when the player clicks the button again. I do not know why this is working, I understand that this is a repost but I have not been given an answer before..
local Player = game.Players.LocalPlayer.PlayerGui
local theScript = game.StarterGui.Music.musicMan.ImageButton.LocalScript
local button = script.Parent
local wetHands = Instance.new("Sound", Player)
local sweden = Instance.new("Sound", Player)
local subwooferLullaby = Instance.new("Sound", Player)
local miceOnVenus = Instance.new("Sound", Player)
local mc = Instance.new("Sound", Player)
local livingMice = Instance.new("Sound", Player)
local haggstrom = Instance.new("Sound", Player)
local danny = Instance.new("Sound", Player)
local dryHands = Instance.new("Sound", Player)
haggstrom.SoundId = "http://www.roblox.com/asset/?id=559471050"
livingMice.SoundId = "http://www.roblox.com/asset/?id=559470478"
mc.SoundId = "http://www.roblox.com/asset/?id=559470109"
miceOnVenus.SoundId = "http://www.roblox.com/asset/?id=559469730"
wetHands.SoundId = "http://www.roblox.com/asset/?id=559730038"
sweden.SoundId = "http://www.roblox.com/asset/?id=559534950"
subwooferLullaby.SoundId = "http://www.roblox.com/asset/?id=559469065"
danny.SoundId = "http://www.roblox.com/asset/?id=560091855"
dryHands.SoundId = "http://www.roblox.com/asset/?id=560091413"
danny.Name = "Danny"
dryHands.Name = "Dry Hands"
wetHands.Name = "Wet Hands"
sweden.Name = "Sweden"
subwooferLullaby.Name = "Subwoofer Lullaby"
miceOnVenus.Name = "Mice on Venus"
mc.Name = "MC"
livingMice.Name = "Living Mice"
haggstrom.Name = "Haggstrom"
musicTable = {wetHands, sweden, subwooferLullaby, miceOnVenus, mc, livingMice, haggstrom, danny, dryHands}
local function RandomizeTable(tbl)
local returntbl={}
if tbl[1]~=nil then
for i=1,#tbl do
table.insert(returntbl,math.random(1,#returntbl+1),tbl[i])
end
end
return returntbl
end
coroutine.resume(coroutine.create(function()
while true do
musicTable=RandomizeTable(musicTable)
for i,v in pairs(musicTable) do
v:Play()
wait(v.TimeLength)
end
end
end))
local oneplaying=false
local function stopandstart()
while true do
for i,v in pairs(Player:GetChildren()) do
if v:IsA("Sound") then
if v.IsPlaying then
v:Stop()
oneplaying=true
end
end
end
if oneplaying==false then
end
end
end
button.MouseButton1Click:connect(function(stopandstart)
end)

1 comment
Don't forget to mark this question as answered if my answer helped you, bud! Have a nice day! ;)