HumanoidStateType is not a valid member of Humanoid "Workspace.StinksSquad.Humanoid"

When the player dies its supposed freeze it and put a highlight on the player and map but It keeps giving me this error


heres the code as well

game.Players.LocalPlayer.CharacterAdded:Connect(function()
	local player = game.Players.LocalPlayer
	local ServerStorage = game:GetService("ServerStorage")
	local char = player.Character
	repeat 
		wait()
		char = player.Character
	until char ~= nil

	local humanoid = char:WaitForChild("Humanoid")
	local function died()
		if char.Humanoid.Health == 0 then
			while char.Humanoid.HumanoidStateType.Dead == true do
				local map_highlight = ServerStorage.HighlightMap:Clone().Parent == game.Workspace.MapModel
			end
		else
		end


	end
	humanoid.Died:Connect(died)

	repeat wait() until char.Humanoid.HumanoidStateType.Dead == false
	local remove_highlight = game.Workspace.MapModel.HighlightMap
	remove_highlight:Destroy()
end)```
2 Likes

Maybe replace that line with this line?

char.Humanoid:GetState(Enum.HumanoidStateType.Dead)

i don’t think you will be able to use false on it.

1 Like

You’d want to use Humanoid:GetState.

Humanoid:GetState() == Enum.HumanoidStateType.Dead

Replied to the wrong person @StinksSquad

1 Like

It works now, thank you so much.

It works because the HumanoidStateType isn’t a “direct” property (if that makes sense), an alternate way to explain is that if you look at Studio’s Properties pane, it does not show it there either. I’m not sure if it’s because it may be an Enum, though.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.