I’m trying to create a music system from a gui, where it clones a template and you can click on it and see the current song thats playing and who it’s by, I do understand for i loops, i’m trying to get it so when you click the button it shows that song name, id and author. The issue is the for i loops aren’t working as i can see but i have searched for almost a day and couldn’t find anything related on the dev forum and the developer hub.
local Gui = script.Parent.Parent.musicGui
-->
local Frame = Gui.Holder or script.Parent.Holder
local Holder = Frame.Plate or script.Parent.Holder.Plate
local currentFrame = script.Parent.Holder.currentSong
local Template = Holder.Template or script.Parent.Holder.Plate.Template
-->
local SongName = currentFrame.SongName
local SongID = currentFrame.SongID
local SongAuthor = currentFrame.SongAuthor
-->
local music = {
Song1 = {{
SongName = "Some Dance Monkey remix",
SongId = 4532362987,
Author = "",
}};
Song2 = {{
SongName = "Nightcore Sweet but Psycho",
SongId = 5481675798,
Author = "",
}};
Song3 = {{
SongName = "Loudness and Clarity",
SongId = 4120614652,
Author = "Joakim Karud",
}};
Song4 = {{
SongName = "Baby I'm Yours",
SongId = 26493104010,
Author = "",
}};
Song5 = {{
SongName = "7 Rings",
SongId = 5624503572,
Author = "Arianda Grande",
}};
Song6 = {{
SongName = "Sunflower",
SongId = 2723566837,
Author = "Post Malone",
}};
Song7 = {{
SongName = "Butter",
SongId = 2203961758,
Author = "Swiss001",
}};
Song8 = {{
SongName = "Good old Days",
SongId = 3499664079,
Author = "Joakim Karud",};
};
}
--[[
local fresh = Template:Clone()
fresh.Name = File.SongName
fresh.Text = File.SongName
fresh.Parent = Holder
fresh.MouseButton1Click:Connect(function()
SongName.Text = File.SongName
SongID.Text = File.SongId
SongAuthor.Text = File.Author
end)
--]]
local function refresh(Sounded)
for A,B in pairs(music) do
for C,D in pairs(B) do
local E = Template:Clone()
E.Name = D.SongName
E.Text = D.SongName
E.Parent = Holder
E.MouseButton1Click:Connect(function()
SongName.Text = D.SongName
SongID.Text = D.SongId
SongAuthor.Text = D.Author
end)
end
end
end
refresh()
Thanks