I have made this 'saving money system' but I also want it to award the player 5 points for every kill and assign 1 'death' for every death. How would I go about doing this?
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local Cash = Instance.new("IntValue",leader)
Cash.Name = "Money"
Cash.Value = ds:GetAsync(player.UserId) or 0
ds:SetAsync(player.UserId, Cash.Value)
Cash.Changed:connect(function()
ds:SetAsync(player.UserId, Cash.Value)
end)
end)

2 comments
As I see from your comment to the answer below, you do not want leaderstats script of Roblox. This was one of the best options. Another option is scripting weapons for your goal. It should be like: Humanoid:TakeDamage(20) if Humanoid.Health == 0 then Cash.Value = Cash.Value + 5
I have a leaderboard that adds 5 points for each kill and 1 death for each death, but when I added the script above, both of them don't load into the actual game. I have watched many videos but couldn't find any that would fix this issue.