StarterPack

Afficher les obsolètes
Création impossible
Service

A service-level container whose contents are copied into each player's Backpack when the player spawns. It is generally used to hold Tools, but is sometimes used to hold LocalScripts to ensure that each player gets a copy.

When a player's character spawns, the contents of the StarterPack and their StarterGear are copied into their Backpack. Once a character dies, the Backpack is removed and a new one is created -- populating it using the contents of StarterPack and StarterGear.

The StarterPack is used to determine a set of Tools that all players will spawn with. If a developer wants to ensure that certain Tools are available to specific players, then they will need to parent the Tools directly to the player's Backpack instead.

Note: while normally the contents of StarterPack are predefined, the contents can be changed while the game is running by adding and removing Tools accordingly. These updates will pass onto a player's backpack when they respawn and their backpacks are reloaded. Changes to the StarterPack should be made by the server.

A tool can be added to the StarterPack using the following code.


Tool.Parent = game:GetService("StarterPack")

Échantillons de code

Empty StarterPack

local StarterPack = game:GetService("StarterPack")
local function emptyStarterPack()
for _, child in pairs(StarterPack:GetChildren()) do
if child:IsA("Tool") then
child:Destroy()
end
end
end
emptyStarterPack()

Propriétés

Méthodes

Évènements