module.weld=function(O)local D=O.part local g=O.basepart local Y=O.tim or nil local B=O.name or"\087\101\108\100"D.Anchored=false local f=Instance.new("\087\101\108\100")f.Name=B f.Part0=g f.C0=g.CFrame:inverse()f.Part1=D f.C1=D.CFrame:inverse()f.Parent=f.Part1 if Y then game.Debris:AddItem(f,Y)end end module.HitDetection=function(O)local D=O.part local g=D.Parent local Y=O.size or Vector3.new(5,5,5)local B=O.Shape or"\083\113\117\097\114\101"local f=O.cf or D.CFrame local x=O.tim or.5 local o=O.weld local S={}local w=false local J local y,i local H=module.SpawnHB({part=D,cf=f,size=Y,tim=x;Shape=B})S.SpawnedHitBox=H or nil if o then module.weld({part=H;basepart=D})end local m=Zone.new(H)m:setAccuracy("\072\105\103\104")m:setDetection("\087\104\111\108\101\066\111\100\121")task.delay(x,function()w=false m:destroy()end)for O,D in pairs(m:getParts())do if D and D:IsA("\066\097\115\101\080\097\114\116")then if D and(D.Parent and D.Parent~=g)then if D and(D.Parent and(D.Parent:IsA("\077\111\100\101\108")and(D.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")and(D.Parent:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")and(D.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")).Health>0))))then if w==false then w=true J=D.Parent m:destroy()H:Destroy()end end end end end if J then y,i=J:FindFirstChild("\072\117\109\097\110\111\105\100"),J:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")end S.Victum=J or nil S.Vhum=y or nil S.Vroot=i or nil return S end return module

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 .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
