Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

humanoid.Died:Connect(function() doesnt seem to be working... any help?

Doesnt seem to be firing Killed, or printing Killed

local REMOTES 		= ReplicatedStorage:WaitForChild("Remotes")
local Players			= game:GetService("Players")
local player 			= game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character 		= player.Character or player.CharacterAdded:Wait()
local humanoid 		= character:WaitForChild("Humanoid")

player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
	humanoid.Died:Connect(function(player)
		REMOTES.Killed:FireClient()
		print("Killed")
	end)
end)

4 comments

0

I think the script is getting stuck at your player variable. You do not need to use the PlayerAdded method since a local script won't even run before the player has been added.

0

Is this a localscript or regular script

0

I dont see so much of a problem but maybe an easier way to do it is by saying the players health = 0

0

the classic "I don't see a problem" by skids when there are 6 problems present.

1 answer

I had a problem like this before, the way I solved it is by using remote events.

This discussion is preserved as it was. New answers, comments, and votes are closed.