repeat wait()until script.Parent:FindFirstChild("\072\097\110\100\108\101")local l={}function ClearOldWelds(l)for l,y in pairs(l)do if y:IsA("\087\101\108\100")then y:Destroy()end end end function Equipped()local y=script.Parent:FindFirstChild("\072\097\110\100\108\101")if not y then return end local S=y:GetChildren()for S,T in pairs(script.Parent:GetChildren())do if T:IsA("\066\097\115\101\080\097\114\116")and T~=y then local S for l,y in pairs(l)do if l==T then S=y break end end if not S then l[T]=T.CFrame:inverse()*y.CFrame T.Anchored=false S=l[T]end local s=Instance.new("\087\101\108\100")s.Part0=y s.Part1=T s.C0=CFrame.new()s.C1=S s.Parent=y end end ClearOldWelds(S)y.Anchored=false end Equipped()script.Parent.Equipped:connect(Equipped)
--[[The local script included in this model can only be used if
1. The weapon is being placed in the players backpack first (i.e. the weapon is in starterpack and moves to player backpack)
OR
2. The weapon is previously welded (weapon can be placed in workspace and picked up then)
]]
repeat
	wait()
until script.Parent:FindFirstChild("Handle")
local welds = {}
function ClearOldWelds(tbl)
	for _, v in pairs(tbl) do
		if v:IsA("Weld") then
			v:Destroy()
		end
	end
end

function Equipped()
	local handle = script.Parent:FindFirstChild("Handle")
	if not handle then
		return
	end
	local tble = handle:GetChildren()
	for _, v in pairs(script.Parent:GetChildren()) do
		if v:IsA("BasePart") and v ~= handle then
			local c1
			for _1, v1 in pairs(welds) do
				if _1 == v then
					c1 = v1
					break
				end
			end
			if not c1 then
				welds[v] = v.CFrame:inverse() * handle.CFrame
				v.Anchored = false
				c1 = welds[v]
			end
			local weld = Instance.new("Weld")
			weld.Part0 = handle
			weld.Part1 = v
			weld.C0 = CFrame.new()
			weld.C1 = c1
			weld.Parent = handle
		end
	end
	ClearOldWelds(tble)
	handle.Anchored = false
end
Equipped()
script.Parent.Equipped:connect(Equipped)
