Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you use Script.Source with multiple lines?

Asked by 2 years ago

im making a plugin, and it should make a script but i dont know how it would make multiple lines, my current code

local toolbar = plugin:CreateToolbar("Create Part")
local CHS = game:GetService("ChangeHistoryService")

local button = toolbar:CreateButton("Add leaderstats", "Creates quicker", "rbxassetid://4370186570")

button.Click:Connect(function()
    local leaderstats = Instance.new("Script")
    leaderstats.Parent = game.Workspace
    leaderstats.Source = "-- i need help here lol"
end)

2 answers

Log in to vote
0
Answered by
wf_sh 15
2 years ago

You can create a multi-line string literal using either double square brackets or the \n (newline) escape sequence.

print([[
Hello
World!
]])

print("Hello\nWorld!")

In your case, I would simply use the first option and copy paste the code into the string.

Ad
Log in to vote
0
Answered by 2 years ago

Just put enter in then paste all your code in there. I don't know what else to say.

0
actually, now that I think about it, it might be wrong syntax. Try it either way. Finty_james 269 — 2y

Answer this question