Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make Max Inventory slot?

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

2 comments

0

you can loop over the backpack and make sure its children are not more than the max?

0

Edit. Is something like my post

2 answers

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

1 comment

0

Yeah, Im thinking that too.

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.

1 comment

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,

This discussion is preserved as it was. New answers, comments, and votes are closed.