Copy and pasting a function from one script to another, yields the same result as calling that function in another script using a modulescript. I don't think copying the text is possible unless you make a complex function that takes parameters to do so. Your best option is to just use a module script to use the code in that module script in other scripts (which is the same result as what you are trying to do.)
the code below is in a module script. Pretend the name of this script is "PrintModule" and its in the workspace.
local module = {
yourfunction = function(textyouwanttoprint)
print(textyouwanttoprint)
end,
}
In the normal script
local module2 = require(game.Workspace.PrintModule)
local texttoprint = "ModuleCalled"
module2.yourfunction(texttoprint)
The output will have printed "ModuleCalled"
The function in the module can be replaced with pretty much anything, if you are looking to call that function in other scripts. You want to copy code from one script to another, instead of that this puts code in a module script which can be called from another script. Which runs that code in the script you called it from.
4 comments
you can clone a script, you can use remote events to do things from the server to client, you can ctrl c v, you can use "require()" for module scripts then run functions in other scripts, you can use .Source = "code" assuming ur working in the command bar and plugins.
oh not to mention you can use loadstring but that will allow every exploiter in existence to ruin your game
No I don't mean like cloning the script normally, I mean taking code from a script, and importing it into the script that went to copy it.
i gave you every possible answer to this question