Oh, I thought you had it working already xD
Ehh, hah I actually don't know. I thought I used it like this but apparantly I changed it on my server.
You can use this code instead,
function onUse(player, item, fromPos, target, toPos, isHotkey)
if not item:getType():isContainer() then...