The Backpack instance inside Player instance is recreated each time the player spawns, causing it’s connections to disconnect after player respawns
Examples:
-- This code won't function properly because the connection will be immediately disconnected when the player's character spawns
player.Backpack.ChildAdded:Connect(function()
print("A new tool has been added.")
end)
-- This code will function properly, as it creates the connection when the character spawns
player.CharacterAdded:Connect(function()
player.Backpack.ChildAdded:Connect(function()
print("A new tool has been added.")
end)
end)
Expected behavior
Backpack should be emptied when player is about to respawn. Backpack should not be destroyed and recreated.