rojo/.cursor/rules/roblox/reference/engine/classes/Backpack.yaml
2026-02-02 12:08:47 -06:00

53 lines
1.9 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Backpack
type: class
memory_category: Instances
summary: |
A container object that holds a player's inventory. Any `Class.Tool` in a
player's Backpack will be displayed in their inventory at the bottom of their
screen.
description: |
A container object that holds a player's inventory. Any `Class.Tool` in a
player's Backpack will be displayed in their inventory at the bottom of their
screen. Selecting `Class.Tool|Tools` from the inventory will equip the
`Class.Tool`, moving it from the Backpack to the player's character.
The Backpack can also store `Class.Script|Scripts` and
`Class.LocalScript|LocalScripts`, which run when placed in a player's
Backpack.
When a player's character spawns, the contents of the `Class.StarterPack` and
their `Class.StarterGear` are copied into their Backpack. Once a character
dies, the Backpack is removed and a new one will be created -- populating it
with the contents of `Class.StarterPack` and `Class.StarterGear`.
Roblox provides an interface for a player to access their backpack and
inventory by default at the bottom of the screen. If a developer wishes to
disable the default Roblox backpack GUI and replace it with their own, they
may do so using `Class.StarterGui:SetCoreGuiEnabled()`.
The Backpack can be accessed from both the client and the server.
```lua
local Players = game:GetService("Players")
-- Accessing Backpack from a Server Script:
local backpack = Players.PlayerName.Backpack
-- Accessing Backpack from a LocalScript:
local backpack = Players.LocalPlayer.Backpack
```
code_samples:
- Backpack-Give-Tool
inherits:
- Instance
descendants: []
tags: []
deprecation_message: ''
properties: []
methods: []
events: []
callbacks: []