Why doesn't my script work?

Hello developers. I’m trying to achieve a script where if a player dies then it prints out something on the console. I’m just experimenting yet I cannot find a solution.
It is a local script placed in StarterCharacterScripts. Don’t judge I took a break from scripting and now dumb as ever.

game.Players.PlayerAdded:Connect(function(player)
player.CharacterRemoving:Connect(function()
print(“experimental”)
end)
end)

I think this article should help you.

game:GetService('Players').PlayerAdded:Connect(function(player) -- When the player joins...
	player.CharacterAdded:Connect(function(character) -- Wait for their character to be added
		character:WaitForChild("Humanoid").Died:Connect(function()
			print("experimental") -- Once they die, do whatever you want
		end)
	end)
end)
1 Like

Ah yes just shows how damned stupid I am these days. Thanks for the help!

1 Like