How i can fix this?

i created a game like minecraft factions but i forgot this, exploiters can break every ore with this code

for i,v in pairs(game.Workspace.Blocks.Lapis:GetChildren()) do
    if v:IsA("Part") then

        local args = {
            [1] = {
                [1] = "BlockDestroy",
                [2] = v,
                [3] = 10000,
                [4] = 10
            }
        }

        game.ReplicatedStorage.SRE:FireServer(unpack(args))
    end
end

i scripted something but you can use this script anyway

i dont know how to fix this, if you know can you help me?

just add checks on the server

for example:

  • check if they break a block an impossible distance away
  • check if they break more than one block in a certain time
2 Likes

You could cast a ray from the player to the block they’re attempting to hit to see if it is visually obstructed and take the magnitude of the ray to see if they’re within tool range for the pickaxe to work. That’d sanity check mining something they can’t reach + something they can’t see.

2 Likes