module.weld=function(I)local b=I.part local V=I.basepart local p=I.tim or nil local h=I.name or"\087\101\108\100"b.Anchored=false local t=Instance.new("\087\101\108\100")t.Name=h t.Part0=V t.C0=V.CFrame:inverse()t.Part1=b t.C1=b.CFrame:inverse()t.Parent=t.Part1 if p then game.Debris:AddItem(t,p)end end module.HitDetection=function(I)local b=I.part local V=b.Parent local p=I.size or Vector3.new(5,5,5)local h=I.Shape or"\083\113\117\097\114\101"local t=I.cf or b.CFrame local i=I.tim or.5 local Z=I.weld local F={}local T=false local C local o,M local r=module.SpawnHB({part=b;cf=t;size=p;tim=i;Shape=h})F.SpawnedHitBox=r or nil if Z then module.weld({part=r,basepart=b})end local G=Zone.new(r)G:setAccuracy("\072\105\103\104")G:setDetection("\087\104\111\108\101\066\111\100\121")task.delay(i,function()T=false G:destroy()end)for I,b in pairs(G:getParts())do if b and b:IsA("\066\097\115\101\080\097\114\116")then if b and(b.Parent and b.Parent~=V)then if b and(b.Parent and(b.Parent:IsA("\077\111\100\101\108")and(b.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and(b.Parent:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")and(b.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")).Health>0))))then if T==false then T=true C=b.Parent G:destroy()r:Destroy()end end end end end if C then o,M=C:FindFirstChild("\072\117\109\097\110\111\105\100"),C:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")end F.Victum=C or nil F.Vhum=o or nil F.Vroot=M or nil return F end return module
--weld
module.weld = function(data)
	local part = data.part
	local base = data.basepart
	local tim = data.tim or nil
	local name = data.name or "Weld"
	part.Anchored = false
	--base.Anchored = false

	local Weld = Instance.new("Weld")
	Weld.Name = name
	Weld.Part0 = base
	Weld.C0 = base.CFrame:inverse()
	Weld.Part1 = part
	Weld.C1 = part.CFrame:inverse()
	Weld.Parent = Weld.Part1

	if tim then
		game.Debris:AddItem(Weld, tim)
	end
end

module.HitDetection = function(Data)
	local part = Data.part
	local model = part.Parent
	local size = Data.size or Vector3.new(5, 5, 5)
	local Shape = Data.Shape or "Square"
	local cf = Data.cf or part.CFrame
	local tim = Data.tim or 0.5
	local weld = Data.weld

	local tab = {}
	local db = false
	local Victum
	local Vhum, Vroot

	local SpawnedHitBox = module.SpawnHB({ part = part, cf = cf, size = size, tim = tim, Shape = Shape })
	tab.SpawnedHitBox = SpawnedHitBox or nil

	if weld then
		module.weld({ part = SpawnedHitBox, basepart = part })
	end

	-- HB
	local zone = Zone.new(SpawnedHitBox)
	zone:setAccuracy("High")
	zone:setDetection("WholeBody")
	--print(zone)

	task.delay(tim, function()
		db = false
		zone:destroy()
	end)

	for i, v in pairs(zone:getParts()) do
		if v and v:IsA("BasePart") then
			if v and v.Parent and v.Parent ~= model then
				if
					v
					and v.Parent
					and v.Parent:IsA("Model")
					and v.Parent:FindFirstChild("Humanoid")
					and v.Parent:FindFirstChild("HumanoidRootPart")
					and v.Parent:FindFirstChild("Humanoid").Health > 0
				then
					if db == false then
						db = true

						Victum = v.Parent

						zone:destroy()
						SpawnedHitBox:Destroy()
					end
				end
			end
		end
	end

	--

	if Victum then
		Vhum, Vroot = Victum:FindFirstChild("Humanoid"), Victum:FindFirstChild("HumanoidRootPart")
	end
	tab.Victum = Victum or nil
	tab.Vhum = Vhum or nil
	tab.Vroot = Vroot or nil

	return tab
end

return module
