Humanoid.died not working

I’m pretty sure you can’t do .LocalPlayer.Humanoid. You need to do GetPlayerFromCharacter instead! Edit, I used your code in the original post and tried it ingame. I put da local script under characterscripts and made a event called Died. It worked and printed “e” when i died. Check if u got event named Died with correct spelling, check if script is under startercharacterscripts.

well here’s the server script,

wait()
local Died = game.ReplicatedStorage.Died

Died.OnServerEvent:Connect(function(plr)
local xBlock = game.ReplicatedStorage.Drop:Clone()
xBlock.Position =  plr.Character.Torso.Position + Vector3.new(0,2,0)
xBlock.Parent = game.Workspace
xBlock.Rock.Value = plr.Resources.Rock.Value
xBlock.Metal.Value = plr.Resources.Metal.Value
xBlock.Wood.Value = plr.Resources.Wood.Value
wait(0.1)
plr.Resources.Rock.Value = 0
plr.Resources.Metal.Value = 0
plr.Resources.Wood.Value = 0
end)

and the mod from Gmor

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(c)
        c.Humanoid.Died:Connect(function()
            local xBlock = game.ReplicatedStorage.Drop:Clone()
xBlock.Position =  plr.Character.Torso.Position + Vector3.new(0,2,0)
xBlock.Parent = game.Workspace
xBlock.Rock.Value = plr.Resources.Rock.Value
xBlock.Metal.Value = plr.Resources.Metal.Value
xBlock.Wood.Value = plr.Resources.Wood.Value
wait(0.1)
plr.Resources.Rock.Value = 0
plr.Resources.Metal.Value = 0
plr.Resources.Wood.Value = 0
        end)
    end)
end)

aaaand it don’t work

1 Like

That is because when the player dies, their torso doesn’t exist.

1 Like

How about you try printing the CFrame of the player’s torso after they died, and see if it returns nil

1 Like

that is the weird part, if i misspelled it would send an error, but there are none

then how would i get their torso position, do i have make a part being in the torso position every second or something?

so you have: placed the localscript under startercharacterscripts and have an remoteevent named “Died” in ReplicatedStorage? If so the code should work since I tested it a couple mins ago in studio and it worked when i respawned. Also it did print “e”.

From what I’m seeing, it looks like a game where you kill others and get their loot when they die or something like that?

1 Like

but i checked everything and 99% sure nothing is misspelled

That is one possible way, or you could just detect where the player is every frame and save their CFrame

huh anyways how would i fix the humanoid.died issue, if i were to use server sided script?

I literally just did. You can do a print at the start of the died function to see if it works. If it prints, then its your code that’s your problem