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

player backpack doesnt update?

Hello, the player backpack isnt updating. An example:

I have the following code in a part with a click detector. On clicking, it prints the number of tools in the character's backpack (twice, due to the new console). However, if i change the tools in the backpack (destroying it, for example), it keeps printing the same amount.

`

script.Parent.ClickDetector.MouseClick:connect(function(player)

local bp = game.Players:FindFirstChild(player.Name).Backpack:GetChildren()

print(#bp)

end)

`

5 comments

0

Could you give us more details? Screenshots, etc?

0

Sure! this is the part with the script: https://ibb.co/bNS3Ae (more images incoming)

0

as you can see, i have 12 elements in the backpack. When clicking, the console outputs 12, which is correct: https://ibb.co/kpQ6Ve (last image incoming)

0

but if i destroy something and click again, it keeps printing the same amount: https://ibb.co/nQkUiz

0

This isn't a solution but - use Connect instead of connect, and also you can say player.Backpack instead of the whole game.Players:FindFirstChild because player is passed in as an argument when the MouseClick event is fired.

1 answer

nobody had problems with the backpack? i'm the only one?

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