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

How can I check to see if the workspace is being edited?

Asked by 8 years ago
Edited 8 years ago

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!!!

0
Just use FilteringEnabled and then any exploits they may make won't matter. Perci1 4988 — 8y
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) iamnoamesa 674 — 8y
0
No FE, please! AstrealDev 728 — 8y
0
What's wrong with FE? Better learn how to use it first than to have to re-learn everything. Link150 1355 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.

Ad

Answer this question