game.ReplicatedStorage.ToggleItem.OnServerEvent:connect(function(player, obj, toggleType)
if toggleType == "Equip" then
for i,v in pairs(player.PlayerGui.Inventory.Background:GetChildren()) do --This is the line
if string.sub(v.Name, 1, 5) == "Image" then
if v.Item.Value == obj.Name then
player.Character.Humanoid:EquipTool(obj:Clone())
end
end
end
elseif toggleType == "Unequip" then
player.Character.Humanoid:UnequipTools()
end
end)
On the line indicated above in the code, I always get an error. I checked my hierarchy and everything, it is correct. But for some odd reason, it always says 'Inventory is not a valid member of PlayerGui'. Any clue on how to fix this problem? Thanks!
(PS, this is a Server Script!)

2 comments
What is the specific error?
You do not have the inventory as in PlayerGui. The inventory is a core gui, that is why it says your inventory isen't a valid member.