--local freeSpaceX,freeSpaceY,freeSpaceZ = 3,3,2.8

local freeSpace = Vector3.new(3,2.8,3)
local box = script.Parent
local contents = box.Contents

local lidOffset = 3 

function r(num)
return math.random(-math.abs(num*100),math.abs(num*100))/100
end

box.Base.Touched:connect(function(oldHit)

if (oldHit:FindFirstChild("Draggable") and oldHit:FindFirstChild("Pickup")) or
(oldHit.Parent and (oldHit.Parent:FindFirstChild("Draggable") and oldHit.Parent:FindFirstChild("Pickup")))
then
local hit
if oldHit.Parent:IsA("Model") and oldHit.Parent ~= workspace then
hit = oldHit.Parent:Clone()
oldHit.Parent:Destroy()
elseif oldHit.Parent == workspace then
hit = oldHit:Clone()
oldHit:Destroy()
end


hit.Draggable:Destroy()

if hit:IsA("BasePart") then
hit.Anchored = true
hit.CanCollide = false
local vary = freeSpace-hit.Size