Title is pretty self explanatory. I have not come across any way to do this and I am starting to wonder if i am just blind, or this is not possible. If this is possible to do, I would appreciate some tips on how to do so.
Cheers,
Robyn
Title is pretty self explanatory. I have not come across any way to do this and I am starting to wonder if i am just blind, or this is not possible. If this is possible to do, I would appreciate some tips on how to do so.
Cheers,
Robyn
Sure!
Say I have a ServerScript that is located inside of ServerScriptService. The code inside would need to be copied by the server, and for this example, be written inside a textlabel (ex. TextLabel.Text = copiedText).
To answer your question directly, I am unfamiliar if you can read script code with other scripts outside of plugins/Studio. To fulfill your mentioned use case - you can leverage ModuleScripts to do this.
Place a ModuleScript in a replicated location to allow for both a local and server script to read/use the code within it. Place one in a server-only location for only a server script to be able to read/use the code within it.
You can copy the script instance itself using Script:Clone(). There is a source property, but it’s locked from access unless it’s a plugin. Here’s an example that copies a disabled (Enabled property set to false) to a different location and enables it.
local serverScriptService = game:GetService("ServerScriptService")
local someScript = serverScriptService:FindFirstChild("SomeScript")
local someLocation = Location to copy script to
local newScript = someScript:Clone()
newScript.Parent = someLocation
newScript.Enabled = true
It’s impossible to do this, as ServerScripts can’t directly read the source code of other scripts, including their own, during runtime. If you want to get specific text, then you would need to use a ModuleScript.
I dont think Nasa, Apple or even Google have such complicated scripts that extract code from other files and then modify unless youre talking about Python connection to MySQL database and etc.
Your answer to the title is no.
That’s not what I want to do. I want the script’s contents to be copied and placed in a TextLabel so that a player could see it.
That may work. It seems a bit messy, but it’s probably one of the only ways to do this. If anyone else has other ideas, I would highly appreciate some. One more question for you/anyone that will answer this:
How does this game get Lua code from the player and
Format the code like Roblox Studio
Run the code
I would assume they did it through a lot of UI and scripting that UI. I could be wrong, but I don’t believe it had anything to do with taking code of out scripts or putting it into scripts.
Yes, I get that, I just don’t want to create another topic.
Well, that is how they did it, can you specify what you mean exactly by, “How did this game get Lua code from that player and Format the code like Roblox Studio and Run The code.”
Well, I am wondering how this game got the lua code from the player, executed it, and gave it an output. They also have protection against running code that could mess with the server.
I don’t believe that the game actually executes the code. They probably have systems to check, similar to an “if statement,” that if you type the correct stuff, the game runs its own actual code that makes those things happen.
Okay, thank you. Now that that question is answered, back to the original topic.
You can’t sadly. The one thing that would cripple hackers. Verifying the code has not been changed or added to in anyway.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.