#Backpack VS Custom inventory system

1 messages · Page 1 of 1 (latest)

paper jay
#

I've been looking at making a custom inventory system and since the games I've been playing recently are fisch and grow a garden, I've noticed the similarities, one of them the inventory system, I was just wondering if this was a custom inventory system or a modified backpack, and if it's modified could anyone link me a guide on how it works ?

open iron
#

up

#

also trying to make the same thing

#

I'll hyu when I find some useful info tho

paper jay
#

I've asked gpt and it says that it's a custom inv system

#

I got the impression that it was different because the way you access it is the same, but apparently you just disable the backpack and make a custom one, I'm following this tutorial to learn how, It's pretty good imo

open iron
#

oh yea

#

I've been looking for tuts for a longgg time

#

this has to help

#

cause my hotbar is separated

left wyvern
#

you have to disable default roblox inventory with startergui service and then make your own ui and then script it and yeah thats all

twilit frigate
#

yea

#

disable the roblox backpack ui

#

then u gotta make ur own ui

#

then make events for when a tool is added, removed, used, etc.

#

it took me 1-2 days

#

on my first time

paper jay
#
function validateSlot(player, slot)
    --makes sure the slot is an instance and that it's a tool
    if typeof(slot) ~= "Instance" or not slot:IsA("ObjectValue") then return end
    
    local inventoryFolder = player[inventoryFolderName]
    local hotbarFolder = inventoryFolder[hotbarFolderName]
    local backpackFolder = inventoryFolder[backpackFolderName]
    
    --makes sure that the slot (ObjectValue) is in one of those 2 folders
    return slot.Parent == hotbarFolder or slot.Parent == backpackFolder
end
function swapSlots(player, slot1, slot2)
    
    local slot1TEMP = slot1.Value
    slot1.Value = slot2.Value
    slot2.Value = slot1TEMP
    
    local inventoryFolder = player[inventoryFolderName]
    local backpackFolder = inventoryFolder[backpackFolderName]
    
    if slot1.Parent == backpackFolder and not slot1.Value then
        shiftBackpackValuesDown(backpackFolder, slot1)
    elseif slot2.Parent == backpackFolder and not slot2.Value then
        shiftBackpackValuesDown(backpackFolder, slot2)
    end
end

SwapSlotsRE.OnServerEvent:Connect(function(player, slot1, slot2)
    if slot1 == slot2 then return end
    
    if not validateSlot(player, slot1) or not validateSlot(player, slot2) then return end
    
    swapSlots(player, slot1, slot2)
end)
#

im having issues with this

#

idk why it's not working

#

im recording a vid but i have no clue why it's not working

left wyvern
#

why tf do u have server event for swapping slots

paper jay
#

erm

#

idk

left wyvern
#

server should only verify when item is dropped or picked up

paper jay
#

the tutorial said so

left wyvern
#

bro what tutorial is ts? 😭

#

byteblox?

#

thedevking?

paper jay
paper jay
#

😭

left wyvern
#

no

#

just make your own

#

some of these youtube tutorials are stupid as shit

paper jay
#

okay okay, but is the basis good? like this part

function createInventoryFolder(player: Player)
    --made the inventory folder
    local inventoryFolder = Instance.new("Folder")
    inventoryFolder.Name = inventoryFolderName
    inventoryFolder.Parent = player
    
    --made the hotbarfolder and parented it to the inventory folder
    local hotbarFolder = Instance.new("Folder")
    hotbarFolder.Name = hotbarFolderName
    hotbarFolder.Parent = inventoryFolder
    --added the objectvalue (hotbar slots) to the hotbar folder 
    for i=1, numHotbarSlots do
        local hotbarSlotValue = Instance.new("ObjectValue")
        hotbarSlotValue.Name = i
        hotbarSlotValue.Parent = hotbarFolder
    end
    
    --made the backpack folder and parented it to the inventory folder
    local backpackFolder = Instance.new("Folder")
    backpackFolder.Name = backpackFolderName
    backpackFolder.Parent = inventoryFolder
    

end
#

just to know where to start from

#

😭

left wyvern
#

nah

paper jay
#

fml

left wyvern
#

make it statically outside of scripts then just clone it

#

its more performant

paper jay
#

ohhh

#

okay okay

left wyvern
#

also dont make values for hotbar slots

#

thats not very intelligent

#

client can control that

paper jay
#

dawg i was questioning it whilst watching the tutorial but i just didnt change it 😭

left wyvern
#

dont just blindly follow youtube tutorials

#

some of them r really stupid as i said

paper jay
#

Yeah i noticed, like

#

i questioned it, but siad this guy probs knows better

#

so the server should clone the pre made inventory from RS and then manage the values of the items and shit server side

#

but like

left radishBOT
#

studio** You are now Level 5! **studio

paper jay
#

i need to learn how to send like oh, i've picked up ts, how does the client tell that to the server securly ?

left wyvern
#

is client within pickup range? is the item even dropped to begin with? does the client have enough inventory space? can the client pick up the item?

paper jay
#

okay oaky

#

so the client on a local script has a pickup script that sends a remote event to the server ?

left wyvern
#

yes, client requests to pick up item and server validates whether they can pick it up or not and then gives it to them if they can

#

same with dropping items

paper jay
#

okay oaky

#

wish me luck

left wyvern
#

gl

open iron
#

ngl bro

#

the tutorial suck

#

so I just watched brawldev scripting course

#

but I'm boutta make it soon fr

paper jay
paper jay
#

like

left wyvern
#

make ui

paper jay
#

if i cant make objectvalues

#

no like the backend

#

likle

#

if im not useing objectvalues for the slots

#

how do you make them ?

left wyvern
#

you dont need values for the slots on server side

#

just store the player's inventory items in a folder and let the client manage their slots/ui

paper jay
#

So just like, make a template with the inventory table and clone that for every player ?

#

and in that table put the items ?

left wyvern
#

yeah if u want

paper jay
#

what do you suggest I do ? im kinda very lost

#

😭

#

pleas

open iron
#

learn

#

about uis

#

like events and shi

#

functions

#

also

#

unequipped

#

equipped

#

backpackupdate

#

and textures

#

those are the one you should focus on

#

and just basic knowledge

#

you'll be good

paper jay
#

okay oaky, thanks