local function x(x)local t={Model=nil;Outline=nil,Parts={}}local Z=ITEMS[x.Name]:Clone()Z.Parent=EFFECTS Z:BreakJoints()local o=require(Z:WaitForChild("\067\111\110\102\105\103"))local b=ITEMS[x.Name]if b:FindFirstChild("\065\116\116\097\099\104\109\101\110\116\115")then local t=x:WaitForChild("\065\116\116\097\099\104\109\101\110\116\115")for x,t in pairs(t:GetChildren())do local o=ITEMS[t.Name]:Clone()local b=require(o.Config)o:SetPrimaryPartCFrame((Z.PrimaryPart.CFrame*Z.PrimaryPart[b.Attach.."\065\116\116\097\099\104"].CFrame)*o.PrimaryPart.Attach.CFrame:inverse())o.Parent=Z o:BreakJoints()end end local V=Instance.new("\077\111\100\101\108")V.Name="\079\117\116\108\105\110\101"V.Parent=EFFECTS t.Model=Z t.Outline=V local y=Z.PrimaryPart:FindFirstChild("\067\101\110\116\101\114")for x,o in pairs(Z:GetDescendants())do if o:IsA("\066\097\115\101\080\097\114\116")then o.CFrame=CFrame.new(0,-100,0)o.Anchored=true o.CanCollide=false local x=o:Clone()x.Name="\079\117\116\108\105\110\101"x.Material=Enum.Material.Neon x.Color=OUTLINE_COLOR x.Size=x.Size+Vector3.new(OUTLINE_WIDTH,OUTLINE_WIDTH,OUTLINE_WIDTH)if x:IsA("\077\101\115\104\080\097\114\116")then x.TextureID=""end x.Parent=V local b={Part=o;Outline=x,Offset=CFrame.new()}if y then b.Offset=y.WorldCFrame:toObjectSpace(o.CFrame)else b.Offset=Z.PrimaryPart.CFrame:toObjectSpace(o.CFrame)end table.insert(t.Parts,b)end end drops[x]=t x.AncestryChanged:connect(function()if x.Parent~=DROPS then if drops[x]then drops[x].Model:Destroy()drops[x].Outline:Destroy()drops[x]=nil end end end)end
-- functions

local function HandleDrop(d)
	local drop = {
		Model = nil,
		Outline = nil,
		Parts = {},
	}

	local model = ITEMS[d.Name]:Clone()
	model.Parent = EFFECTS
	model:BreakJoints()

	local config = require(model:WaitForChild("Config"))
	local base = ITEMS[d.Name]

	if base:FindFirstChild("Attachments") then
		local attachments = d:WaitForChild("Attachments")

		for _, attach in pairs(attachments:GetChildren()) do
			local attachment = ITEMS[attach.Name]:Clone()
			local config = require(attachment.Config)
			attachment:SetPrimaryPartCFrame(
				model.PrimaryPart.CFrame
					* model.PrimaryPart[config.Attach .. "Attach"].CFrame
					* attachment.PrimaryPart.Attach.CFrame:inverse()
			)
			attachment.Parent = model
			attachment:BreakJoints()
		end
	end

	local outline = Instance.new("Model")
	outline.Name = "Outline"
	outline.Parent = EFFECTS

	drop.Model = model
	drop.Outline = outline

	local center = model.PrimaryPart:FindFirstChild("Center")

	for _, v in pairs(model:GetDescendants()) do
		if v:IsA("BasePart") then
			v.CFrame = CFrame.new(0, -100, 0)
			v.Anchored = true
			v.CanCollide = false

			local o = v:Clone()
			o.Name = "Outline"
			o.Material = Enum.Material.Neon
			o.Color = OUTLINE_COLOR
			o.Size = o.Size + Vector3.new(OUTLINE_WIDTH, OUTLINE_WIDTH, OUTLINE_WIDTH)
			if o:IsA("MeshPart") then
				o.TextureID = ""
			end
			o.Parent = outline

			local info = {
				Part = v,
				Outline = o,
				Offset = CFrame.new(),
			}

			if center then
				info.Offset = center.WorldCFrame:toObjectSpace(v.CFrame)
			else
				info.Offset = model.PrimaryPart.CFrame:toObjectSpace(v.CFrame)
			end

			table.insert(drop.Parts, info)
		end
	end

	drops[d] = drop

	d.AncestryChanged:connect(function()
		if d.Parent ~= DROPS then
			if drops[d] then
				drops[d].Model:Destroy()
				drops[d].Outline:Destroy()
				drops[d] = nil
			end
		end
	end)
end
