#The script wont workrkk

1 messages · Page 1 of 1 (latest)

idle temple
#

`local customInventoryRS = game.ReplicatedStorage.CustomInventory

local inventorySettings = customInventoryRS.Settings
local numHotbarSlots = inventorySettings.NumHotbarSlots.Value
local inventoryFolderName = inventorySettings.InventoryFolderName
local hotbarFolderName = inventorySettings.HotbarFolderName
local backpackFolderName = inventorySettings.BackpackFolderName.Value

function createInventoryFolder(player)

local inventoryFolder = Instance.new("Folder")
inventoryFolder.Name = inventoryFolderName

local hotbarFolder = Instance.new("Folder")
hotbarFolder.Name = hotbarFolderName
hotbarFolder.Parent = inventoryFolder

for i = 1, numHotbarSlots do
    local hotbarSlotValue = Instance.new("ObjectValue")
    hotbarSlotValue.Name = 1
    hotbarSlotValue.Parent = hotbarFolder
end

local backpackFolder = Instance.new("Folder")
backpackFolder.Name = backpackFolderName
backpackFolder.Parent = inventoryFolder

inventoryFolder.Parent = player

end

function onPlayerAdded(player)
createInventoryFolder(player)
end

game.Players.PlayerAdded:Connect(onPlayerAdded)`

This is supposed to create folders when you test the game but for some reason they don't and i'm unsure why

polar steeple
#
local customInventoryRS = game.ReplicatedStorage.CustomInventory

local inventorySettings = customInventoryRS.Settings
local numHotbarSlots = inventorySettings.NumHotbarSlots.Value
local inventoryFolderName = inventorySettings.InventoryFolderName
local hotbarFolderName = inventorySettings.HotbarFolderName
local backpackFolderName = inventorySettings.BackpackFolderName.Value

function createInventoryFolder(player)
    
    local inventoryFolder = Instance.new("Folder")
    inventoryFolder.Name = inventoryFolderName
    
    local hotbarFolder = Instance.new("Folder")
    hotbarFolder.Name = hotbarFolderName
    hotbarFolder.Parent = inventoryFolder
    
    for i = 1, numHotbarSlots do
        local hotbarSlotValue = Instance.new("ObjectValue")
        hotbarSlotValue.Name = 1
        hotbarSlotValue.Parent = hotbarFolder
    end
    
    local backpackFolder = Instance.new("Folder")
    backpackFolder.Name = backpackFolderName
    backpackFolder.Parent = inventoryFolder
    
    inventoryFolder.Parent = player
end

function onPlayerAdded(player)
    createInventoryFolder(player)
end

game.Players.PlayerAdded:Connect(onPlayerAdded)
#

for ease of reading