Question
Is there a way to write into scripts from other scripts?
For an example, a function that would write a string into a script
Example:
local SCRIPT = game.Workspace.ScriptToWriteIn SCRIPT:Write("Bla bla bla") --Then it would write Bla bla bla into the script
Is this possible? if so how? I've checked a couple of times and no one asked this!
Thanks!
MIXGINGENGERINA10
No, that is not possible. Anyway, maybe you're interested in the loadstring() LUA function, which loads a string and converts it to a function you can execute.
[https://www.robloxdev.com/api-reference/property/ServerScriptService/LoadStringEnabled] [https://www.robloxdev.com/articles/Built-in-Functions-and-Variables/Lua#loadstring]
For loadstring() to work the LoadStringEnabled property of ServerScriptService must be true. Please mind using loadstring() is insecure.
I suppose I have a way of writing into other scripts, but not editing the actual scripts. I haven't tested this out so I have no idea if it will work but give it a try! It works by using coroutines and sending them over in an event
****Script 1
lol = coroutine.create(function() -- your script here print("your nan is gonna kill me") end) game:GetService("ReplicatedFirst").ScriptWriteEvent:Fire(lol) -- firing the function
****Script 2
game:GetService("ReplicatedFirst").ScriptWriteEvent.Event:Connect(function(coroutine) -- receiving the event coroutine.resume(coroutine) end)
For more information on coroutines go here
~tantec has a big lasting tan with a fran and he cant rhyme for his life