I need help with a Code Executer

Well do you have any solutions on how I can execute code on a local script to make my local and server replicator of firing code?

Do you think you can go on studio with me and help? Or insert the code? please

What is getfenv() by the way? lol

Roblox doesn’t provide any way of executing code locally (since exploiters could just use Roblox’s code for that to run their scripts) so you won’t really be able to.

You can run server code with the dev console in your games (press F9 in game and go to the Server logs, there is a bar at the bottom where you can type or paste in lua code to run, and, then you can just hit enter and it’ll run)

If you want to run client code from the dev console you’d have to load it from Roblox. You can do that by creating a ModuleScript and calling it MainModule (this tells Roblox that its the main module so you can use require and give the id of it once you upload it). You can put a LocalScript inside of the MainModule, and in your MainModule you can Parent the LocalScript somewhere where it will run for you. Then just save the ModuleScript to Roblox by right clicking it and selecting Save to Roblox, that way you can require it. You just need to copy its id, and then you can run require(assetId) and the module will run.

One way that might be easy to do all of that would be to use game.CreatorId and do Players:GetPlayerFromUserId(game.CreatorId), or you can give it a specific player if you make the module return a function to parent the local script instead. You can parent the local script to player.Backpack and it will run for them. So, then, when you want to run some local code, you can edit it in studio, right click on MainModule, and select Save to Roblox, then you can require the asset id.

(P.s. when you require a module it gets cached, so, if you update it, and try to require it again after you’ve already required it in that server it will be the old module… I can help you come up with a better but maybe more confusing way if you want, that wouldn’t use modules but would still involve uploading a script)

I can’t really do this, but, I don’t think H6x is actually what you want anyways, since you said in your post you just want to run code for yourself. H6x is meant for the few games that will want to run other people’s code in them.

1 Like

You can read about it on the devhub here: Lua Globals (roblox.com)

Just press Ctrl+F and you can type in getfenv and it’ll show up

1 Like

Yes not my command bar thing with F9 I will show you right here

client:
image

server:
image

I want the client to work :slight_smile:

There isn’t really a way to do that, you kind of just have to deal with uploading your scripts to Roblox and then you can load them with require(assetId) or you can use InsertService:LoadAssetVersion() which can load something you upload to Roblox, like a LocalScript that you can put into your Backpack, so, that way you can run local code.

Also, if you join your game, press F9, it will open the developer console which is a console you can use, it lets you run code. That’s what @Unknownstaffmembe was showing you and that’s what I was trying to say before:

If you are a developer of a game (so, if you have edit access) you can use this in any of your games, its part of Roblox, there isn’t anything you have to download or add.

Then how come I see other people do it with client code?

Like in Void Script Builder? Void Script Builder is the one example of a game I know of that can run local code.

I believe Void Script Builder has a website set up and they can tell their website to upload a local script to Roblox, and then they can load the script once its uploaded via InsertService. That’s how one of their moderators explained it to me.

I know they also used to use a lua in lua executor (basically the code for the lua itself but rewritten in lua instead of C, so, “lua in lua”) a long time ago but those are really outdated and I don’t know of any that work very well and you probably can’t find them easily.

Oh well then my Whole idea is just gonna be gone now :frowning: Well do you wanna atleast be friends?

What was your idea? Do you have anything you are trying to do with being able to execute code?

Yes I am trying to do stuff inside my RP game without game console but I now cannot :frowning:

Technically Trolling Gui :grinning_face_with_smiling_eyes:

You can still upload a script and load it with the dev console though!

If you want to run a local script there are still ways you can do it as long as you are uploading it. You can have studio open and you can write whatever code you want to run into your local script. Then you could have a button in your gui that loads your script that you saved, or you could do it from the dev console.

You could make it run server scripts the same way if you wanted to, and, you could even load in other Instances you put inside of it.

How would I make the code into the devconsol fire into the localscript?

You wouldn’t be able to put the code in from inside of your game, but, you could put your code in from in studio and then you could save the script. Then in your game you can have it load the saved script.

Since you just want to do it for you, that means instead of using your GUI to type the code you can type the code into your LocalScript that you saved to Roblox’s website. Then in your GUI you can make it so that it will load that script off of Roblox when you click a button for example.

You can look at these functions, they are what you would use to load the script you saved into the server:
InsertService:LoadAsset (roblox.com) - This will let you load it once, the next time you try to load it Roblox will reuse the one it already loaded (Which is called caching, to help prevent lag for people who might be using this a lot Roblox will just reuse the one it already got, since, when you load an asset the Roblox server is basically downloading it from Roblox’s website… If you called it 100 times and it didn’t cache, it would be kind of like downloading 100 files)

InsertService:GetLatestAssetVersionAsync (roblox.com) - You can use this and the function below to load the latest version of your LocalScript. This just returns a long number that tells Roblox what specific version of the script you want to load.
InsertService:LoadAssetVersion (roblox.com) - This lets you load a specific version of something into the game. It works kind of like LoadAsset, but, it will only cache for that version. So if you load version 123456 5 times it will only download it one time, but if you load version 123456 and then load version 123456789 it will download each one separately.

That function just returns the instances you saved inside of a Model instance, so you can do something like this:

local assetId = 1234 -- The id of the asset you are loading
local InsertService = game:GetService("InsertService")
local scriptHolder = InsertService:LoadAssetVersion(InsertService:GetLatestAssetVersionAsync(assetId)) -- Load the asset

local localScript = scriptHolder:WaitForChild("LocalScript") -- Get the local script from it that you saved
localScript.Parent = player.Backpack -- Put it in the backpack of the target player. (This lets you run code for other people too by changing the player)

That’s just a basic example, you could put that into the dev console if you wanted to and load your script.

1 Like

Adonis Loadstring, contains client-side loadstring() and server-side.
Here I’m lending you every detail you desire for so badly.

AdonisLoadstring.rbxm (65.5 KB)

Here is how it function properly.

Localscript (Make sure its being operated inside a localscript) :

local AdonisLoadstring = script.Parent.AdonisLoadstring
local Loadstring = require(AdonisLoadstring)
local Script = "print(game.Players.LocalPlayer.Name)" --- On the localscript version it only requires client-side script.
Loadstring(Script)()

Script (Well same as the localscript but you necessarily want to use Server script for this to run in server-side) :

local AdonisLoadstring = script.Parent.AdonisLoadstring
local Loadstring = require(AdonisLoadstring)
local Script = "game.Players.FrazedGreatness2:LoadCharacter()" --- On the Server script version it only requires Server-side script.
Loadstring(Script)()

Hope this helps you out buddy!

Your whole idea is here now! :wink: If you know how this thing works, Great job!