How to make Script In Script With variables In Lines

hey!
I am trying to create a script that creates a script with lines that within the script that creates the script there are variables that I want to put inside the script that the script creates

is an example:

local variable = "hi!"


local scriptt = Instance.new("Script", game.StarterPack)
scriptt.Name = "script name"
scriptt.Source = [[
	
	variable
	
]]

How to do it?

If you are creating a plugin than what you wrote should work.

As long as you change it to

scriptt.Source = [[
	
	]].. variable ..[[
	
]]

(or something similar)


If not then there are multiple ways to do it depending on what you want to do exactly…

as far as I know Source cant be used in scripts or localscripts

you cant change the source of a script unless you have plugin authorization

You can only use Source in the command line or plugins. Assuming you are making a plugin:

Can you elaborate on what you mean with the variables? Do you want this script to run with defined variables? Or do you want your script to use the same variables as the plugin?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.