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 a max inventory tool system?

How would I make a max tool system, like if someone has 9 tools, then they can't have anymore?

3 comments

0

Could you be more descriptive

0

Show us a script of the progress you have on this so far and we'll help fix it.

0

Do not request stuff. Also just check when they obtain a new tool and if its above the limit just remove the tool / prevent it from being picked up.

1 answer

Make sure this is a LocalScript and placed in StarterPlayerScripts.

local player = game.Players.LocalPlayer
local backpack = player:WaitForChild("Backpack")
backpack.ChildAdded:Connect(function(child) -- fires an event every time a child is added to the player's backpack.
	local childrenAmount = #backpack:GetChildren()
	print(child,childrenAmount)
	if childrenAmount > 9 then
		game.Debris:AddItem(child,1)
	end
	
end)

This way whenever a tool is added, it will check if there are more than 9 elements in the backpack and if so, it will remove that element after 1 second.

If this answer has helped you, please consider upvoting and marking it as correct.

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