the problem is that its not working
the problem is that its not working
function module.equipItem(Player, ItemName, Count)
local Data = module.Profiles[Player]
if not Data then
warn("Data not found for player")
return
end
warn("start1")
-- Check if the item exists in the game's ReplicatedStorage.Inv.Materials
local part = game.ReplicatedStorage.Inv.Materials:FindFirstChild(ItemName)
if not part then
warn("Item not found in ReplicatedStorage.Inv.Materials")
return
end
local partcategory = part:GetAttribute("Category")
warn("start2")
local itemsinfo = require(script.Parent.itemsinfo)
local itemInfo = itemsinfo.Items[partcategory] and itemsinfo.Items[partcategory][ItemName]
print(part)
print(itemInfo) -- Use print to check the retrieved item information
if not itemInfo then
warn("Item information not found in itemsinfo module")
return
end
warn("start3")
local canEquip = itemInfo.Equipable
if canEquip then
warn("start5")
local character = Player.Character
if character then
-- Add the item to the player's Backpack
local backpack = Player:FindFirstChild("Backpack")
if backpack then
local itemClone = part:Clone()
itemClone.Parent = backpack
warn("successful")
end
end
updateInventory(Player)
end
end
then inside of my itemsinfo script is
local InventoryItem = {}
-- Define your inventory items with categories
InventoryItem.Items = {
Swords = {
{
Name = "Sword",
Equipable = true,
Droppable = true,
Description = "A sharp sword for battle."
},
{
Name = "Axe",
Equipable = true,
Droppable = true,
Description = "A heavy axe for chopping wood."
},
{
Name = "FishingRod",
Equipable = true,
Droppable = false,
Description = "A sharp sword for battle."
}
},
Potions = {
{
Name = "Health Potion",
Equipable = false,
Droppable = true,
Description = "Restores health when consumed."
},
{
Name = "Mana Potion",
Equipable = false,
Droppable = true,
Description = "Restores mana when consumed."
}
}
}
return InventoryItem
the tool
error code through my debugging