I have a short script here, it's meant to reset the "Spree" leaderstat of a player to 0 when it dies. It doesn't reset.
PPS = game:GetService("PointsService")
game.Players.PlayerAdded:connect(function(player)
counter = Instance.new("NumberValue",player)
counter.Name = "Counter"
counter.Changed:connect(function(item)
if counter.Value >= 10 then
counter.Value = 0
player.leaderstats.FPoints.Value = player.leaderstats.FPoints.Value +1
PPS:AwardPoints(player.userId,1)
end
end)
while wait() do if player.Character ~= nil then break end end
player.Character.Humanoid.Died:connect(function() counter.Value = 0 player.leaderstats.Spree.Value = 0 end)
end)

1 comment
So this script will reset the stat to zero no matter how many deaths occur? Also, This script is a separate script from the script which includes creating leaderstats.