Tabletop Simulator

Tabletop Simulator

[Tool] Make Anything a Bag
Trying to figure out updating the Mod.
Any1 know how to add this script into this Mods Script? Trying to make anyThing into a self refilling Bag.
SELF REFILLING SCRIPT:

open = false
list = {}
index = 1

function onObjectSearchStart(obj)
if obj == self then
open = true
end
end

function onObjectSearchEnd(obj)
if obj == self then
open = false
if index != 1 and self.getDescription() == "on" then
for i = 1, index - 1 do
if list != nil then
local objClone = list.clone({position = self.getPosition()})
self.putObject(objClone)
end
end
index = 1
end
end
end

function onObjectLeaveContainer(container, obj)
if container == self and self.getDescription() == "on" then
if open then
list[index] = obj
index = index + 1
else
local objClone = obj.clone({position = self.getPosition()})
self.putObject(objClone)
end
end
end