How can i limit the player backpack to two tools at a time ?
COMMUNITY QUESTION
Limited backpack ?
2 answers
There are many ways to do this. First of all, you could index them all and if i>2 then all you would have to do is remove a tool or more if needed. You could also just have conditional statements pretty much count them out 1 by 1 and if there is more then 2 then you could just have it remove some.
Bind a ChildAdded event to the Backpack.
ex:
local Backpack = game.Players.LocalPlayer.Backpack
Backpack.ChildAdded:connect(
function(child)
local Items = #Backpack:GetChildren()
print("There are now "..tostring(Items).." in "..game.Players.LocalPlayer.Name.."'s backpack!")
if Items > 2 then
-- Code here!
end
end
)
This discussion is preserved as it was. New answers, comments, and votes are closed.
