I need help with a Code Executer

I want to make a code executer

I do not know how to code the rest of it I tried many things

I have went to youtube.com

My code executer is used only for me and I am trying to make it so when I type code it automatically fires it which in my case causes stuff to happen but I really need help getting started I do not want you to make a script for me just help me get started please.

--local script
local event = script.Parent.event

local CodeBox = script.Parent.CodeBox

CodeBox.FocusLost:Connect(function()
	event:FireServer(CodeBox.Text)
end)

--Script
script.Parent.event.OnServerEvent:Connect(function(player,text)
	
end)
3 Likes

I am not using this for a Virus by the way so you know because people sometimes get mad over stuff like this

For this, you can use the loadstring() function:

script.Parent.event.OnServerEvent:Connect(function(player,text)
	loadstring(text)()
end)

Why contents?
:grinning_face_with_smiling_eyes:

I never used loadstring before

1 Like

I meant to put text instead of contents, I copy and pasted it from one of my other projects

I get this error :grinning_face_with_smiling_eyes:

image

Make sure the loadstring property is enabled.

1 Like

got to servserscript service, and under properties change the LoadStringEnabled property to true

1 Like

My game may be vunerable to exploits

I will say yours in solutions too can only solution one

Only if you have some kind of backdoor or virus that can input commands into your game.

Ok well I do not use free models or bad plugins so I am good right?

I believe so yes, but don’t take my word for it. I am not the best at Roblox game security

1 Like

It’s the only way for your loadstring() to operate, loadstring requires game.ServiceScriptService.LoadStringEnabled = true for it to work.

1 Like

It is ok :slight_smile: THank you so much though I am very happy

I have one more question :grinning_face_with_smiling_eyes: @kaiyellow2008

How would I make it so if there is a keyword such as local or print I can make it change that word a color and only that word

I’ve had the same trouble, but that is a different topic and you should post that question as a different topic.

1 Like