Humanoid states not being replicated under certain condition

Hi! I’ve found out that if you put a custom character to a player, disable The Died state on client and server and set the health to 0, the humanoid state will stop replicating on server!

--put this in server scripts with a custom character named CustomCharacter parented to it
game.Players.PlayerAdded:Connect(function(P)
	P.CharacterAdded:Connect(function(C)
		local new = script.CustomCharacter:Clone()
		new.Parent = workspace
		new.PrimaryPart.CFrame = C.PrimaryPart.CFrame
		P.Character = new
		C = new
		local H = C:FindFirstChildWhichIsA("Humanoid")
		H:SetStateEnabled(Enum.HumanoidStateType.Dead,false)
		H.StateChanged:Connect(function(old,new) -- Will stop replicating states on 0hp ONLY if it has custom character
			warn(new)
		end)
		task.wait(5)
		H.Health = 0
	end)
end)
--put this in starterplayerscripts
local P = game.Players.LocalPlayer
P.CharacterAdded:Connect(function(C)
	local H = C:FindFirstChildWhichIsA("Humanoid")
	H:SetStateEnabled(Enum.HumanoidStateType.Dead,false)
	H.StateChanged:Connect(function(old,new)
		print(new)
	end)
end)

after doing this you will notice that when the character reaches 0hp you will not get the warnings anymore since the new states wont replicate, this will keep going unless you make the health ~= 0
THIS BUG APPLIES ONLY IF USING CUSTOM CHARACTERS
Video proof:

Place1.rbxl (336.7 KB)

Just realized it’s gonna loop. But the issue keeps going even without it being a loop.

Just set H:SetStateEnabled(Enum.HumanoidStateType.Dead,false) on the client and remove the line where you’re setting it on the server. HumanoidStateType should replicate automatically

Tested, can confirm it happens whenever the Character property gets manually changed, even if CharacterAutoLoads is false and the Character property gets set manually the first time.

It seems like humanoid replication behavior is breaking slightly when doing player.Character = rig as opposed to LoadCharacter/LoadCharacterWithHumanoidDescription.

To fix, use LoadCharacterWithHumanoidDescription or put your rig named StarterCharacter inside StarterPlayer to let Roblox handle spawning.

2 Likes