Help Tools Won't Unequip Through My Script

Hello! So I’m making an inventory gui in roblox and it works fine the first time you equip and unequip but the second time it doesn’t work and I get hit with an error “Something unexpectedly tried to set the parent of Katana to Items while trying to set the parent of Katana. Current parent is FunTraps.”

Please help in any way possible!

Video

ScriptImages
Explorer

GetItemsOutOfInventory Where I assume where the problem is at or the main script kinda

GetRidOfThem

CreateFolder

TriggerInventory

Scripts
GetItemsOutOfInventory Where I assume where the problem is at or the main script kinda
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Items = ReplicatedStorage:WaitForChild("Items"):Clone()
Items.Parent = player.Inventory
local Inventory = player.Inventory
local ItemName = script.Parent.Parent:WaitForChild("ItemName")

for _, Button in pairs(script.Parent:GetChildren()) do
	if Button:IsA("TextButton") then
		Button.MouseButton1Click:Connect(function()
			local Item = Inventory.Items:FindFirstChild(Button.Name)
			Item.Parent = player.Backpack
			Button.Parent = Inventory.GuiInventory
		end)
	
	
		Button.MouseEnter:Connect(function()
			ItemName.Text = Button.Name
		end)
		Button.MouseLeave:Connect(function()
			ItemName.Text = ""
		end)
	end
	
end

GetRidOfThem
local player = game.Players.LocalPlayer
local Frame2 = script.Parent.Parent.Frame2
local Exit = game.ReplicatedStorage:WaitForChild("Exit")

script.Parent.MouseButton1Click:Connect(function()
	Exit.OnInvoke = function(Tool)
		for _, Button in pairs(player.Inventory.GuiInventory:GetChildren()) do
			if Button:IsA("TextButton") then
				if Button.Name == Tool.Name then
					Button.Parent = Frame2
					Tool.Parent = player.Inventory.Items
				end
			end
			
		end
		
	end
end)

CreateFolder
game.Players.PlayerAdded:Connect(function(player)
	local Inventory = Instance.new("Folder", player)
	Inventory.Name = "Inventory"
	local GuiInventory = Instance.new("Folder", Inventory)
	GuiInventory.Name = "GuiInventory"
end)
TriggerInventory
local player = game.Players.LocalPlayer
local Inventory = player.PlayerGui.InventoryGui:WaitForChild("Frame1")
local ItemName = Inventory:WaitForChild("ItemName")
local Exit = game.ReplicatedStorage:WaitForChild("Exit")
local Tool = script.Parent

script.Parent.Equipped:Connect(function()
	ItemName.Text = script.Parent.Name
	Exit:Invoke(Tool)
end)

script.Parent.Unequipped:Connect(function()
	ItemName.Text = ""
	
end)

Can you tell me what FunTraps is? I don’t know why the parent of the Katana would be set to that.