I have the following script in my serverscripts:
// priority: 1000000
const itemHandler = {
createItemStack: (itemId, amount) => {
return {id: itemId, count: amount}
},
getItemOf: (itemStack) => {
return Item.of(itemStack.id, itemStack.count);
},
getItemIngredient: (itemStack) => {
return {
"count": itemStack.count,
"id": itemStack.id
};
}
};
const fluidHandler = {
createFluidStack: (fluidId, amount) => {
return {id: fluidId, amount: amount}
},
getFluidOf: (fluidStack) => {
return Fluid.of(fluidStack.id, fluidStack.count);
},
getFluidIngredient: (fluidStack) => {
return {
"amount": fluidStack.amount,
"id": fluidStack.id
};
}
};
global.itemHandler = itemHandler;
global.fluidHandler = fluidHandler;
It serves as a way for me to handle items and fluids easily, but that is besides the point.
When I run this code, I get the attached error
by commenting out the bottom 2 lines (globalizing the variables), this error disappears. I declared them at the bottom while debugging, normally I would just directly declare them but here we are.
I have done this exact same thing, creating a global object with functions, at multiple other scripts in the same instance already, yet here it breaks, and I can't figure out why.

