This Script doesn't Save
local Use_DB = true function saveStat(plr,val,key) if plr then plr:WaitForDataReady() plr:SaveNumber(key,val) end end function loadStat(plr,key,stat) if plr then plr:WaitForDataReady() stat.Value = plr:LoadNumber(key,val) end end game.Players.PlayerAdded:connect(function(player) Stat = Instance.new("IntValue",player) Stat.Name = "leaderstats" Kills = Instance.new("IntValue",Stat) Kills.Name = "Kills" Deaths = Instance.new("IntValue",Stat) Deaths.Name = "Deaths" if Use_DP then loadStat(player,"Kills",Kills) loadStat(player,"Deaths",Deaths) end player.CharacterAdded:connect(function(char) char.Humanoid.Died:connect(function() Deaths.Value = Deaths.Value +1 if Use_DP then saveStat(player,Deaths.Value,"Kills") end Cre = char.Humanoid:FindFirstChild("creator") if Cre then if Cre.Value then if Cre.Value ~= player then Cre.Value.leaderstats.Kills.Value = Cre.Value.leaderstats.Kills.Value +1 else Kills.Value = Kills.Value -1 end if Use_DP then saveStat(Cre.Value,Cre.Value.leaderstats.Kills.Value,"Kills") saveStat(player,Kills.Value,"Kills") end end end end) end) end)
Help Please!