Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i make Max Inventory slot?

Asked by 4 years ago

So, i want to make a horror game with max inventory slot. but i don't know how to make it. have any ideas?

0
you can loop over the backpack and make sure its children are not more than the max? thefatrat87 18 — 4y
0
Edit. Is something like my post GuerraReturns 122 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

If I am not mistaken, in roblox the inventory is initially endless.

0
Yeah, Im thinking that too. 6zk8 95 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You need a Server Script with a function called from the Client.

local ItemBackground = workspace.Items
local MaxInventory = 1 -- max inventory

local function Take(player,object)
--  for i = 1, player.Backpack:GetChildren() do -- take all weapons from the Backpack
    for i, v in pairs(player.Backpack:GetChildren() do -- take all weapons
        if i == MaxInventory then -- if weapons is 1 -- if weapon is 1 inside the player inventory
            local weap = ItemBackground[object]:Clone() -- clone the item in ground
            weap.Parent = player.Backpack -- insert the weapon inside the player Backpack
            ItemBackground[object]:Destroy() -- ddestroy item in ground

            local Clone = v:Clone() -- clone the item inside the Backpack
            Clone.Parent = ItemBackground -- put the item in ground
        else
            local weap = ItemBackground[object]:Clone()
            weap.Parent = player.Backpack -- insert the weapon inside the player Backpack
            ItemBackground[object]:Destroy()
        end
    end
end

You need create a folder in workspace and call it "Items", inside this folder add all your object inside the workspace.

You need call "Object" value from the client

I can't write a code without information, but is something like this. You need connect this function.

0
Sorry for late post dude, i want to make max inventory like in piggy. that i cant more then 1 tool in the backpack, Friskyman321 121 — 4y

Answer this question