Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i resolve this dev console error?

Asked by 5 years ago

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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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?

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. User#27525 1 — 5y
Ad

Answer this question