Problem with humanoid.Died:Connect(function) (Solved)

I want the player to receive his guns but in order to do so, I need the humanoid:Died function to work more than once. I’ve tried other methods already posted on DevForum but they don’t seem to be working for me. The issue is that humanoid.Died plays only once then after that I need to update the variable humanoid to fit the new humanoid without ruining the rest of the code that require the variable humanoid.

I’ve tried code like:

--// Edited [Solved]

The local script is located in StarterPlayerScripts

Does anybody know how to fix this?

player.CharacterAdded:Connect(function(plr)
	
	print(humanoid.Parent)
	
-	plr:WaitForChild("Humanoid")
+      local newHumanoid = plr:WaitForChild("Humanoid")
+ --make new died connection for the new humanoid
+ newHumanoid.Died:Connect(function()
+ --insert code previously working for humanoid
end)	

1 Like

Thank you so much! Your code worked and I really appreciate your help.

1 Like