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

how do i check how many of a tool is in a player's inventory?

I have a script that checks if you have more than one tomato picked up in your inventory, then tells you that you already have one if you already have one, with a gui controlled by a module script "wait"

but i dont know how to check how many of a tool is inside your inventory

cd.MouseClick:Connect(function(humanoid)

if db then
		db = false
	local inv = humanoid.Backpack 
	local tool = game.ServerStorage["Tomato"]
	tool:Clone().Parent = inv
		wait(2)
		if humanoid.Backpack.Tomato > 0 then --i dont know how to check 
			waitgui.enableAndDisable() --enableAndDisable is a function inside the module
			db = true
                end
          end
end)

1 answer

✓ Accepted answer
if #humanoid.Backpack:GetChildren()>0 then
--check 

3 comments

0

Please read the note and adjust your answer accordingly.

0

yea i get that he didnt explain it but it works so thanks

0

add friend me and i will help you make game bro

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