# I need help on implementing a inventory system for my game

**URL:** <https://forum.defold.com/t/i-need-help-on-implementing-a-inventory-system-for-my-game/79751>\
**Category:** Questions\
**Created:** [February 12, 2025, 9:48am UTC](https://forum.defold.com/t/i-need-help-on-implementing-a-inventory-system-for-my-game/79751 "2025-02-12T09:48:25Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Philip\_Marettu](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/philip_marettu/32/38572_2.png) [@Philip\_Marettu](https://forum.defold.com/u/Philip_Marettu)\
**Post date:** [February 20, 2025, 10:43pm UTC](https://forum.defold.com/t/i-need-help-on-implementing-a-inventory-system-for-my-game/79751/4 "2025-02-20T22:43:47Z")

</div>

hi sorry i got carried away from doing larger objectives rather than focusing on the smaller ones, I will leave this for later as I have an issue where the game says:  
 ![image](https://forum-defold-uploads.b-cdn.net/optimized/3X/4/a/4a7fcf3e7441c27a1b20af6df5b2bfc09f47a2b1_2_690x13.png)  
For context: I am trying to send a message from the enemy.script where should the enemy die it spawns a item onto the players screen like a pickup item when a enemy is defeated.  
The code from enemy.script is:

```lua
function drop_items(self)
	if self.enemy_health <= 0 then
		local enemy_pos = go.get_position()
		if self.drop_rate > 0.3 then
			msg.post("game:/scroll_spawner", "spawn scroll", {position = enemy_pos})
			print("scroll dropped", enemy_pos)
		else
			print("no scroll dropped")
		end
	end
end
the code for scroll_spawner is
function on_message(self, message_id, message, sender)
	if message_id == hash("spawn scroll") then
		factory.create("#scroll_factory", message.position)
		print("spawned scroll at: ", message.position)
	end	
end

```

i don’t know how to get rid of the error

---

_[View the full topic](https://forum.defold.com/t/i-need-help-on-implementing-a-inventory-system-for-my-game/79751)._
