In-game Script imitation

Hi, I’m making a game where everyone can execute any script that they want, but, if you’re trying to execute smth, it’s executing the script in “”, so loadstring can’t even do anything with that.

ServerScriptService (Script):

local Remote = game:GetService("ReplicatedStorage"):WaitForChild("ExecuteRemote")

Remote.OnServerEvent:Connect(function(Player, ScriptToExecute)
	if not Player then return end
	if not ScriptToExecute then return end
	
	if Player and ScriptToExecute then
		loadstring(ScriptToExecute)
	end
end)

StarterGui > ScriptGui (ScreenGui) > ExecuteButton (TextButton) (LocalScript):

local Button = script.Parent

function onClick()
	game.ReplicatedStorage.ExecuteRemote:FireServer(tostring(script.Parent.Parent.ScriptBox.Text))
end

Button.MouseButton1Click:Connect(onClick)

When I’m clicking on the button, it’s automatically executing my script that I put in the text box in the “”, so it’s not doing anything. Help!

BTW, I put a tostring when I tried to do it without it, so removing it won’t fix the problem.

Hello!

I am fairly sure you would have to acquire the string value the person sent in the message and compile that into luau or something.

Not sure if this is possible, but you could do this sort of thing by setting up commands with logic statements that allow you to program in another way. I think?

Overall sounds really cool though, and I hope you figure it out!

Note: This game might have problems with people spamming the server or banning/kicking players.

1 Like

I’m making this topic just because I don’t know how to make a script that will fire a remote event without any quotation marks, so I don’t even know about luau and etc.

1 Like

Roblox always firing remotes with using quotation marks, but tonumber() works only on numbers.

Have you tried changing this it to loadstring(ScriptToExecute)()?

2 Likes

Nope, but I’ll try it rn
Nah, this function where you need to write >30 letters is stupid

2 Likes

Sorry I did not realize this was a thing, this is super awesome! ignore what I said I didn’t even know this was possible!

1 Like

Oh lol, it’s working! I just kicked myself lol

1 Like

1 Like

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