well i just need the item to be added to another slot every time i pick it up the more i pick items the more it adds in the inventory slots

thats the code i got for items to be added in the inventory

func add_item(item):
	var item_added = false
	for i in range(len(items)):
		if items[i] != null:
			if items[i].name == item.name:
				item_added = true
				emit_signal("items_changed" , [i])
				return true
				break
	if item_added == false:
		for i in range(len(items)):
			if items[i] == null:
				set_item(i, item)
				item_added = true
				emit_signal("items_changed", [i])
				return true 

and thats the item code

extends Area2D
var item
var inventory = preload("res://colourful gui/codes/Inventory.tres")
onready var sprite = $Sprite

func _ready():
	sprite.texture = item.texture


func _on_KinematicBody2D_body_entered(body):
	if inventory.add_item(item):
		queue_free()

and thats the code that drop items

extends StaticBody2D

var base_item = preload("res://colourful gui/codes/baseitem.tscn")
var drop = preload("res://colourful gui/codes/gun.tres")



func _on_Area2D_body_entered(body):
	drop_item(drop)
	
	
func drop_item(drop):
	var base_item_instance = base_item.instance()
	base_item_instance.item = drop
	base_item_instance.position = position
	get_parent().call_deferred("add_child" , base_item_instance)

Please place ~~~ before and after the code, and use indentation, to make it readable.