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 check to see if the workspace is being edited?

I don't want people to be able to edit the workspace (By this I mean ingame, and by exploiters). How could I go about this?

Possible code:

previousWorkspace = {}
newWorkspace = {}

function checkWorkspace()
	for i,v in pairs(workspace:GetChildren()) do
		table.insert(previousWorkspace, v.Name)
	end
end

function compare()
	for i,v in pairs(previousWorkspace) do
		for ii,vv in pairs(newWorkspace) do
			if v == vv then
				return true
			end
		end
	end
end

while true do
	if compare() then
		-- ?? What next ??
	else
		-- Extra Code
	end
end

Please help! I DO NOT WANT TO USE FE!!!

4 comments

0

Just use FilteringEnabled and then any exploits they may make won't matter.

0

Click on Workspace and change the property of FilteringEnabled to True. Turning it on will stop over 90% of the hackers. (You might have to change some of the codes to work with FE restrictions)

0

No FE, please!

0

What's wrong with FE? Better learn how to use it first than to have to re-learn everything.

1 answer

✓ Accepted answer

Well you could do this:

previousWorkspace = {}
newWorkspace = {}

function checkWorkspace()
    for i,v in pairs(workspace:GetChildren()) do
        table.insert(previousWorkspace, v.Name)
    end
end

game.Workspace.ChildAdded:connect(function() -- If something was added to the workspace
	for i,v in pairs(previousWorkspace) do
        for ii,vv in pairs(newWorkspace) do
            if v == vv then
                return true
	    else
		vv:Destroy() -- Would destroy anything new added
            end
        end
    end
end()

game.Workspace.ChildRemoved:connect(function() -- If something was removed from the workspace
	for i,v in pairs(previousWorkspace) do
        for ii,vv in pairs(newWorkspace) do
            if v == vv then
                return true
	    else
		local reAdd = v:Clone()
		-- then try to find the things last parent.
            end
        end
    end
end()

I mean this could be one way to go about it. This isn't the best way to go about this but, I do hope it kind of pointed you in the right direction.

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