API Reference
Purse unlocks APIs for the CoreGui backpack which were previously locked to other CoreGui scripts. To access the APIs, just require Purse like any other module script.
Methods¶
The following code sample, placed within a child LocalScript of a GuiButton, uses OpenClose() to toggle the inventory on the button's Activated event.
| Inventory Toggle Button | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 | |
OpenClose¶
OpenClose(): ()
Toggles whether or not the inventory is visible.
IsInventoryEmpty¶
IsInventoryEmpty(): boolean
Returns true if the inventory is empty.
Properties¶
IsHotbarVisible¶
IsHotbarVisible: boolean
Determines whether or not the hotbar is visible.
IsOpen¶
IsOpen: boolean
Returns true if the inventory is open.
ModuleName¶
ModuleName: string
Returns "Backpack".
KeepVRTopbarOpen¶
KeepVRTopbarOpen: boolean
Returns true.
VRIsExclusive¶
VRIsExclusive: boolean
Returns true.
VRClosesNonExclusive¶
VRClosesNonExclusive: boolean
Returns true.
Events¶
The following code sample, placed within a child LocalScript of StarterPlayerScripts, uses StateChanged to detect when the inventory is toggled and prints its state to output.
| Detect Inventory State | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 | |
StateChanged¶
StateChanged(isNowOpen: boolean): BindableEvent
Fires after the inventory is opened or closed.
BackpackEmpty¶
BackpackEmpty(): BindableEvent
Fires when the backpack becomes empty.
BackpackItemAdded¶
BackpackItemAdded(): BindableEvent
Fires when an item is added to the backpack.
BackpackItemRemoved¶
BackpackItemRemoved(): BindableEvent
Fires when an item is removed from the backpack.