Region3 Un-synced / Breaking functionality

I’m creating a Stand Rush, and the damage detection is broken.

Old Stand Rush for reference

In the older Stand Rush, I used Magnitude to handle the damage detection. I also checked the Field of View, which I don’t think will be relevant here.

But obviously, this Magnitude system isn’t good as it loops through the entire workspace. Which will definitely cause some lag issues later down the line.

So as a replacement I decided to use Region3, which reduces my search space by a lot, but it isn’t working as intended.

As you can see in the video below it’s un-synced, and it also has this weird bug which kills all the Dummies in the workspace.


Here is the code I use.

MODULE CODE
function GetTarget.GetTargets(character, range, list, view)
	range = range + 1.5 or 4 + 1.5
	view = view or 0.25
	list = list or {character}
	if not table.find(list, character) then
		table.insert(list, character)
	end
	
	local min = character.HumanoidRootPart.Position - Vector3.new(range, range, range)
	local max = character.HumanoidRootPart.Position + Vector3.new(range, range, range)
	local region = Region3.new(min, max)
	
	local targets = {}
	for _, v in pairs(workspace:FindPartsInRegion3WithIgnoreList(region, list)) do
		
		if v.Parent:FindFirstChild("Humanoid") and v.Parent:FindFirstChild("HumanoidRootPart") then
			local target = v.Parent
			local characterToTarget = (target.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Unit
			local characterLook = character.HumanoidRootPart.CFrame.LookVector
			
			local dot = characterToTarget:Dot(characterLook)
			
			if dot > view then
				table.insert(targets, target)
			end
		end
		
	end
	
	return targets
end
SERVER CODE
local targets = GetTarget.GetTargets(starPlatinum, 4, {character})
			
for _, target in pairs(targets) do
	Utilities.spawn(function() — custom spawn function
		target.Humanoid:TakeDamage(1.5)
		local targetBV = Instance.new("BodyVelocity")
		targetBV.MaxForce = Vector3.new(1e6,1e6,1e6)
		targetBV.Velocity = starPlatinum.HumanoidRootPart.CFrame.LookVector * 5
		targetBV.Parent = target.HumanoidRootPart
		Utilities.delay(0.3, function() — custom delay function
			targetBV:Destroy()
		end)
    end)
end