Firstly, you do not need to store the humanoid died connection in a variable because all connections tied to an instance are automatically disconnected as soon as the instance is destroyed.
Secondly, the "ClassName" property of any instance is already a string, making it useless to convert it again to string.
Thirdly, your code assumes that any instance with the word "Value" in it's "ClassName" property is an int value or number value which isn't the case for the other instances that has the word "Value" in its "ClassName" property. (E.g "BoolValue", "StringValue", "Vector3Value", "ObjectValue", etc)
Lastly, you only need to check if the "Name" property of each object is "Timex" since you stated that you only want to reset your time leaderstat called "Timez"
That being said, lets fix your code:
01 | local function onPlayerAdded(plr) |
03 | plr.CharacterAdded:Connect( function (char) |
04 | repeat task.wait() until char.Parent and char:FindFirstChild( "Humanoid" ) |
05 | char.Humanoid.Died:Connect( function () |
06 | for i, v in pairs (plr.leaderstats:GetChildren()) do |
07 | if v.Name = = "Timex" then |
13 | repeat task.wait() until not char.Parent |
18 | game.Players.PlayerAdded:Connect(onPlayerAdded) |
Hope I helped!