I need to sandbox my scriptbuilder so the players can't disconnect players, I have found out how to insert custom values like so:

function code(string)
	-- I insert a custom FE converter before the loadstring here.
	loadstring(string)
end

setfenv(code, {
	Workspace = workspace,
	Game = game,
	-- The above 2 values are for deprecated global value support
	Require = nil,
	require = nil,
	-- I make the "require" value nil to prevent using 'require(num)' to get past my existing sandboxing.
	print = [function(text)
		game.ReplicatedStorage.PrintEvent:FireServer(tostring(text))
	end]
	-- The above function is to redirect the message to a custom GUI output
})

link2string = HttpService:GetAsync( URL )
-- Above fetches the pastebin string.
code(link2string)
--  Above activates the function with the included string.


-- NOTE: This is not my entire code, it is a basic overview.

However, I have no idea how to do the above on global functions like ":Destroy()" or ":FindFirstChild()"

Without that, I cant keep players from disconnecting other players using the global destroy function.

So you can see, I need to know how to edit or disable those global functions otherwise it would be chaos.

So thats where I ask for your help, I have searched around the web and found no clear answer to this question.

A clear, easy to understand answer would make my day.

5 comments

0

Why dont you just run if str:find(":Destroy") then return end ? (And for all your other cases.)

0

Because they can just do something like this, "Player:("Des".."troy")()"

0

string.find is basically the worst way to fix this problem, :/

0

But "Des".."troy" will be "Destroy".

0

Thats not how string.find works, incapaz.