Crash when using HumanoidDescription on many NPCs

I recently added a really simple script to just remove any packages in-game. I do not know if it was the cause but right after I added it the game crashes when I click play.

I have a gui when you die/join and you have to press play, as soon as I press it the game crashes and the Roblox Crash box comes up. I press Ok and Studio shuts down.

The script is messing with the humanoid character description, but this should not make the game crash:

game:GetService("Workspace").DescendantAdded:Connect(function(des)
	if des:IsA("Humanoid") then
		local humanoidDescription = des:GetAppliedDescription()
		humanoidDescription.Head = 0
		humanoidDescription.Torso = 0
		humanoidDescription.RightLeg = 0
		humanoidDescription.LeftLeg = 0
		humanoidDescription.RightArm = 0
		humanoidDescription.LeftArm = 0
		des:ApplyDescription(humanoidDescription)
	end
end)

This happens every time for me and is really annoying. I think I figured out the issue; there were so many NPC’s with humanoids in my game that Studio crashed. I remade it to only apply on players characters, and now it kind of works.

I am running Windows 10 (18362.388) with some Roblox Studio (0.404.0.346082 (64bit)) beta features:

  • Game Access Permissions
  • Animation Editor Beta
  • Enable New Lua VM
  • New Updates Window

Here is a file I made that also crashes.
This doesn’t seem to crash everyone who tries it, but it does crash many of them.
crash.rbxl (29.1 KB)


Of course in my game the dummys were spread out across the whole map unlike this file.

This does infact happen in game, I just get an Disconnected error.

1 Like

I’ll take a look into this issue

1 Like

I looked at the crash.rbxl. This seems to be a timing issue as are you are applying the HumanoidDescription during the spawning process, which is known to cause issues. You are better off doing one of the following. Try adding this to a script:

local function onPlayerAdded(player)
	player.CharacterAppearanceLoaded:Connect(function(character)
		while nil == character.Parent do
			wait()
		end
		
		local humanoid = character:WaitForChild("Humanoid")			
		local humanoidDescription = humanoid:GetAppliedDescription()
		humanoidDescription.Head = 0
		humanoidDescription.Torso = 0
		humanoidDescription.RightLeg = 0
		humanoidDescription.LeftLeg = 0
		humanoidDescription.RightArm = 0
		humanoidDescription.LeftArm = 0
		humanoid:ApplyDescription(humanoidDescription)
	end)
end
game.Players.PlayerAdded:Connect(onPlayerAdded)

or, alternately, this will also work if you add it to a script:

game.Players.CharacterAutoLoads = false
local function onPlayerAdded(player)
	local humanoidDescription = game.Players:GetHumanoidDescriptionFromUserId(player.CharacterAppearanceId)
	humanoidDescription.Head = 0
	humanoidDescription.Torso = 0
	humanoidDescription.RightLeg = 0
	humanoidDescription.LeftLeg = 0
	humanoidDescription.RightArm = 0
	humanoidDescription.LeftArm = 0
	player:LoadCharacterWithHumanoidDescription(humanoidDescription)
end
game.Players.PlayerAdded:Connect(onPlayerAdded)

I’ll also looking into fixing the crash

I changed the script right after I posted, but thanks anyways. I kept the bug report because I still think there is something that needs to be fixed here. Thanks!

1 Like