Humanoid.died not working

this script is in starterpacks

local Ded = game.ReplicatedStorage:WaitForChild("Died")
game.Players.LocalPlayer.Character:WaitForChild('Humanoid').Died:connect(function()
	print("e")
	Ded:FireServer()
end)



it is not printing let alone sending the event, what did i do wrong in here?

1 Like

Try putting the localscript in StarterPlayer > StarterCharacterScripts

Remove this line and it should work

Also use :Connect not :connect

what waaaaaa but i need it to fire the event don’t i?

Its confusing for the script. Humanoid.Died, is the died referring to the variable or event?

nope, theres no error either…strange

change your variable to DiedEvent or anything else because it confuses the script, making it think you want to use the variable and not the Died variable of humanoid.

the event is the first line, defining the event in the storage

No, the question that I was asking is what the script would ask. The script would get confused. Name your variable to something else

hm nope, changed the script but no printing at all

i do not think that is the problem since it did not print either when i changed it

I just realized, why is your script in StarterPack? Put it in StarterPlayer > PlayerScripts or CharacterScripts

maybe try making the character and the humanoid a variable?

and I would suggest using FindFirstChild:("Humanoid")

i did since iBuzzes asked it, so i changed the location

I may be wrong, but can’t you only run .Died on the server?

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(c)
        c.Humanoid.Died:Connect(function()
            --stuff
        end)
    end)
end)

Try this script on the server you don’t have to fire an event

1 Like

i don’t think it matters? because like its just checking if the player’s health and sending a server event?

1 Like

hmm nope

local Ded = game.ReplicatedStorage:WaitForChild("Died")
local humanoid = game.Players.LocalPlayer.Character:FindFirstChild('Humanoid')
humanoid.Died:connect(function()
	print("e")
	Ded:FireServer()
end)

What about you try it on the server, then you won’t have to send a even just like @Gmorcad12345 did:

try this in a server script since you’re gonna go to a server script anyways as others have mentioned

game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			print("works")
		end)
	end)
end)
1 Like