Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i resolve this dev console error?

All i want to do is a dev console. Here's the script and error:

Script:

script.Parent.TextButton.MouseButton1Click:Connect(function(player)
	
	local CurrentScript = false
	CurrentScript = script.Parent.TextBox.Text
	
	CurrentScript()
	
end)

Error:

attempt to call local 'CurrentScript' (a string value)

Well every time i try to use the console, it gives me an error. How can i turn the code i put in the textbox into a script instead of string?

1 answer

✓ Accepted answer

Becaude it's a string value.

CurrentScript is not a function, rather a string. But you can use loadstring to execute Lua code as a string.

It returns a function that you call:

-- in a server script
loadstring("print(1)")()

loadstring can only be called on the server and there's already a dev console, why reinvent the wheel?

1 comment

0

I know that it's a string. The thing is that my friend is the owner of the game, and only the owner have acess to Developer Console.

This discussion is preserved as it was. New answers, comments, and votes are closed.