-
What do you want to achieve? I want to make a custom admin for a game and want to add a console for people to run scripts in if something goes wrong.
-
What is the issue? I don’t know how to make a script that does that.
-
What solutions have you tried so far? didn’t do anything until now and ask.
You don’t just post on devForum as soon as you think of something… Try scripting it yourself and tell us if you have any errors or questions, this is not a place to get free scripts.
the local script
local textbox = script.Parent.TextBox
local button = script.Parent.TextButton
button.MouseButton1Click:Connect(function()
script.Parent.Code:FireServer(textbox.Text)
end)
server script
script.Parent.Code.OnServerEvent:Connect(function(player, sc)
local code = Instance.new("Script", game:GetService("ServerScriptService"))
code.Code = sc
end)
error
00:34:28.028 - Code is not a valid member of Script
There is a property of scripts called Source
which would be what you want to use. However, only plugins and command bar can read from, and write to, the script source. You may be interested in using loadstring
. Though you should make sure to sandbox the code and to make sure on the server side that an admin made the request to execute the code. Otherwise exploiters will destroy your game.