So I have a region3 and I noticed that i can't run a function which deletes un-anchored parts in a region without killing players inside the region.
How would I make it so it does not kill players in the region, but delete unknown un-anchored blocks.
(
Ignore = {workspace.Secure,game.Players}
local topCorner = script.Parent.TopCorner.Position
local bottomCorner = script.Parent.BottomCorner.Position
local region3 = Region3.new(bottomCorner, topCorner)
while wait(0.5) do
local parts = workspace:FindPartsInRegion3WithIgnoreList(region3,Ignore,100)
for i = 1, #parts do
if parts[i].ClassName == "Part" and parts[i].Anchored == true or parts[i].ClassName == "WedgePart" or parts[i].ClassName == "TrussPart" then -- If I only do "parts[i].ClassName == "Part"" then it kills players.
if parts[i].Name == "BottomCorner" or parts[i].Name == "TopCorner" then
parts[i]:Remove()
else
print("Detected "..parts[i].Name.." In Region, ... Deleting ...")
end
parts[i]:Remove()
end
end
end

2 comments
All you have to do is check if the part is a descendant of the player's character.
Would I have to make another If statement or could I make it in the table "Ignore" ?