I've been making this custom inventory, and its very close to being finished. Just one little error on line 2. Here's the script.
game.ReplicatedStorage.EquipItem.OnServerEvent:Connect(function(player, item) player.Character.Humanoid:EquipTool(player.Backpack[item]) end)
I've tried putting "player.Character.Humanoid:EquipTool(player.Backpack[item].Name)" but that still prints out the same error. I've asked help from my friend who knows more about RemoteEvents than me, but he was confused too. I've looked on similar errors that people had, but nothing helped. Could someone please explain this?
Myself i'm not good at scripting, but I think I see the error. In your square brackets try putting "tostring", tostring will probably convert you "Item" into a string.
game.ReplicatedStorage.EquipItem.OnServerEvent:Connect(function(player, item) player.Character.Humanoid:EquipTool(player.Backpack[tostring(item)]) end)
If the item is an object it would be done like this since a string needs to be in the brackets. Putting .Name after the bracket is saying the same thing but gets the name of the item in player.Backpack.
game.ReplicatedStorage.EquipItem.OnServerEvent:Connect(function(player, item) player.Character.Humanoid:EquipTool(player.Backpack[item.Name]) end)