I’m trying to make an Inventory system and the way I’m setting the maximum number of inventory items a player can have is through an IntValue within a folder inside the player. The issue is, when I create the IntValue, it seems to have an issue with setting its parent.
Code Snippet:
local playerInventoryFolder = sentPlayer:FindFirstChild('Inventory') or Instance.new('Folder');
local playerInventorySettings = playerInventoryFolder:FindFirstChild('Settings') or Instance.new('Folder');
local inventorySizeSetting = playerInventorySettings:FindFirstChild('Size') or Instance.new('IntValue');
playerInventoryFolder.Name = 'Inventory';
playerInventorySettings.Name = 'Settings';
inventorySizeSetting.Name = 'Size';
playerInventoryFolder.Parent = sentPlayer;
playerInventorySettings.Parent = playerInventoryFolder;
newInventorySize.Parent = playerInventorySettings;
inventorySizeSetting.Value = newInventorySize;
Prematurely Posted:
Here’s the output error -
23:55:55.911 - ReplicatedStorage.Modules.inventoryModule:20: attempt to index number with 'Parent'
The issue is that I’m not making the variable inventorySizeSetting
the value of the IntValue Instance, I’m just making it the IntValue Instance, yet it seems to think I’m making it the Value of the IntValue Instance.