saaawdust
(sawdust)
March 19, 2023, 3:23pm
#1
I believe this is Script.Source
, and not ScriptEditorService | Roblox Creator Documentation , however let’s say i generate a script, or already have a script that says Print("Hello Dev Forum!")
. What if i wanted to add onto that. I wanted to add on another line, that for example says local Test = 9
, so the whole thing would be:
Print("Hello Dev Forum!")
local Test = 9
i have no idea how you do it, and if it is ScriptEditorService | Roblox Creator Documentation , could someone explain it?
Dede_4242
(Dede_4242)
March 19, 2023, 3:31pm
#2
I think you would do something like:
script.Source = script.Source..--[[
local Test = 9
]]--
CZXPEK
(czo)
March 19, 2023, 3:33pm
#3
local NewScript = "local Test = 9"
Script.Source..="\n"..NewScript
1 Like
CZXPEK
(czo)
March 19, 2023, 3:48pm
#5
\n Creates a new line in the script
Dede_4242
(Dede_4242)
March 19, 2023, 3:50pm
#6
Okay, makes sense…
Would the script I provided work or does it just error?
CZXPEK
(czo)
March 19, 2023, 3:53pm
#7
It would error, it should look like this:
script.Source..=[[
\nlocal Test = 9
]]
or
script.Source = Script.Source..[[
\nlocal Test = 9
]]
(The \n is optional but i would recommend using it so you create a new line)
Prototrode
(Vernumerator)
March 19, 2023, 3:54pm
#8
You should also include ;
to prevent potential ambiguous syntaxes.
Example:
local a = b
(c or d)(e) --this would give off a warning because it could be interpreted as:
-- local a = b(c or d)(e)
1 Like
system
(system)
Closed
April 2, 2023, 3:54pm
#9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.