Morning, I am creating a plugin for the first time and I need to import another script, which is why I’m using Script.Source. However, I have a long script and need to use multiple lines to change the source code of the script that my plugin implements, but I’m not quite sure how.
I’ve tried using square brackets, and can’t seem to find any other solution; here is my script:
local toolbar = plugin:CreateToolbar("Music Autmation 1.0")
local toolbarButton = toolbar:CreateButton("Add Music Automation", "Click to add Music Automation to your game", "rbxassetid://3366737587")
toolbarButton.Click:Connect(function()
local Group = Instance.new("Model", workspace)
Group.Name = "Music Automation 1.0"
local Mainframe = Instance.new("Folder", Group)
Mainframe.Name = "Mainframe"
local MainframeScript = Instance.new("Script", Mainframe)
MainframeScript.Name = "MusicScript"
MainframeScript.Source = "[[-- Do not edit this script
local mainParent = script.Parent.Parent
local songFolder = mainParent:WaitForChild("Songs")
while true do
for _,song in pairs(songFolder:GetChildren()) do
if song:IsA("Sound") then
for _,secondSong in pairs(songFolder:GetChildren()) do
if secondSong ~= song then
secondSong:Stop()
end
end
if song.TimeLength > 100 then
song.Volume = 2
song:Play()
wait(song.TimeLength + 2)
end
end
end
wait()
end]]"
end)