Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

player backpack doesnt update?

Asked by 5 years ago
Edited 5 years ago

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)

`

0
Could you give us more details? Screenshots, etc? HaloUlti 63 — 5y
0
Sure! this is the part with the script: https://ibb.co/bNS3Ae (more images incoming) cKolmos 0 — 5y
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) cKolmos 0 — 5y
0
but if i destroy something and click again, it keeps printing the same amount: https://ibb.co/nQkUiz cKolmos 0 — 5y
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. chomboghai 2044 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

Ad

Answer this question