So my plan is to fill a used venom edge by spawning a "venom_edge" when "venom_edge_empty" is placed on altar.
What am I doing wrong? Here's my script:
function venomFill()
for i in altarPoison:containedItems() do
if i.name == "venom_edge_empty" then
venom_edge_empty:destroy()
altarPoison:addItem(spawn("venom_edge"))
end
end
end
The editor says "attempt to index global 'venom_edge_empty' (a nil value)".
How to fix this problem?
uggardian wrote:So my plan is to fill a used venom edge by spawning a "venom_edge" when "venom_edge_empty" is placed on altar.
What am I doing wrong? Here's my script:
function venomFill()
for i in altarPoison:containedItems() do
if i.name == "venom_edge_empty" then
venom_edge_empty:destroy()
altarPoison:addItem(spawn("venom_edge"))
end
end
end
The editor says "attempt to index global 'venom_edge_empty' (a nil value)".
How to fix this problem?
You try to delete venom_edge_empty instead of the item. Try "i:destroy()" instead of venom_edge_empty:destroy(), this should work
uggardian wrote:So my plan is to fill a used venom edge by spawning a "venom_edge" when "venom_edge_empty" is placed on altar.
What am I doing wrong? Here's my script:
function venomFill()
for i in altarPoison:containedItems() do
if i.name == "venom_edge_empty" then
venom_edge_empty:destroy()
altarPoison:addItem(spawn("venom_edge"))
end
end
end
The editor says "attempt to index global 'venom_edge_empty' (a nil value)".
How to fix this problem?
The error says it all, there is no variable that is named 'venom_edge_empty', you check if the item 'i' is name "venom_edge_empty", if so you should use the item 'i'.
So change 'venom_edge_empty:destroy()' to 'i:destroy()'