As we all know and can agree, that the Region3 is a pretty expensive method for hitboxes for the server to handle
So that’s why I want to convert it to client, so the server won’t crash but the problem is that I have no idea how to convert it, since its late night and I spent most of it fixing one bug.
Piece of code I want to convert:
function newHitBox.Start()
local RotatedRegion3 = RotatedRegion3Module.new(hitboxPart.CFrame,Size) -- Get Region3 of a Part
if(Piece and type(Piece) == "userdata") then
_G[Piece.Name] = true;
coroutine.wrap(function()
while (_G[Piece.Name] == true) do -- Repeat until humanoid is hit or hitbox is stopped
local StuffInRegion = RotatedRegion3:FindPartsInRegion3WithIgnoreList({Character}, math.huge) -- Get all parts in Region3
for i,v in pairs(StuffInRegion) do
print(typeof(v),v.Name)
print(v.Parent:FindFirstChild("Humanoid"))
if v.Parent:FindFirstChild("Humanoid") then
local part = v
local Human = v.Parent:FindFirstChild("Humanoid")
newHitBox.FireEvent(part, Human) --Fire a bindable event
print("Got target")
_G[Piece.Name] = false
break
end
end
wait();
end
end)()
end
end