The Character property contains a reference to a
Model containing a
Humanoid, body parts, scripts and other objects required for simulating the player’s avatar in-game. The model is parented to the
Workspace, but may be moved. It is automatically loaded when
Players/CharacterAutoLoads is true, but can be manually loaded otherwise using
Initially, this property is nil then set when the player’s character first spawns. Use the
Player/CharacterAdded event to detect when a player’s character properly loads, and the
Player/CharacterRemoving event to detect when the character is about to despawn. Avoid using
Instance/GetPropertyChangedSignal on this property.
LocalScripts that are cloned from
StarterPack into a player’s
PlayerGui are often run before the old Character model is deleted. Player.Character still refers to a model, but that model’s parent is nil and it is has been destroyed. Because of this, if the Character already exists, you should check to make sure that the Character’s parent is not nil before using it.
So if you’re writing a
LocalScript under the
StarterPack that requires access to the player’s character, use this:
local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character if not character or not character.Parent then character = player.CharacterAdded:wait() end