It works on Respawn, but there is an error in the output window:
16:53:13.297 **Humanoid::ApplyDescription() DataModel was not available** - Server - Player:32
I have read every forum post I can find on it:
– The parent of Humanoid is not nil. ( 16:53:13.294 Humanoid Parent == mc7oof - Server - Player:30)
— Adding a task.wait() does not fix it.
Here is the code:
local Players = game:GetService("Players")
local function PlayerAdded(Player)
local RESPAWN_DELAY = 4
Players.CharacterAutoLoads = false
Player.RespawnLocation = game.Workspace.SpawnLocation
local function CharacterAdded(Character)
local function HumanoidDied(Character)
task.wait(RESPAWN_DELAY)
Player:LoadCharacter()
end
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(HumanoidDied)
local function AppearanceLoaded()
local CurrentDescription = Humanoid:GetAppliedDescription()
CurrentDescription.Head = 0
CurrentDescription.Torso = 0
CurrentDescription.LeftArm = 0
CurrentDescription.RightArm = 0
CurrentDescription.LeftLeg = 0
CurrentDescription.RightLeg = 0
print("Humanoid Parent ==", Humanoid.Parent)
Humanoid:ApplyDescription(CurrentDescription)
end
Player.CharacterAppearanceLoaded:Connect(AppearanceLoaded)
end
Player.CharacterAdded:Connect(CharacterAdded)
Player:LoadCharacter()
end
for _, Player in Players:GetPlayers() do
task.spawn(PlayerAdded, Player)
end
Players.PlayerAdded:Connect(PlayerAdded)
if Humanoid:FindFirstChild("HumanoidDescription") then
for _, Body in pairs(Humanoid.HumanoidDescription:GetChildren()) do
if Body:IsA("BodyPartDescription") and Body.BodyPart ~= Enum.BodyPart.Head then
Body.AssetId = 0
end
end
end
local function CharacterAdded(Character)
local function AppearanceLoaded(Character) -- character needed here
local Humanoid = Character:WaitForChild("Humanoid") -- humanoid defined here
Player.CharacterAppearanceLoaded:Connect(AppearanceLoaded)
Player.CharacterAdded:Connect(CharacterAdded)