0
votes

So, I am making a Roblox game and it's a battle game. I want to make a cash for kill script, meaning every kill, the KILLER gets +10 cash, and you start off with 0 cash. I've already got a script, see below. I tried everything on the Internet, but NOTHING works. Even the ones from the toolbox. But instead of giving the killer the cash, it gives the killed person cash! I don't want it to be a death for kill script! Here is the code I have another question like this, it will not help. It wasn't useful(It has the leaderboard, and the killed person gets +10 cash.):

game.Players.PlayerAdded:connect(function(player)
 local folder = Instance.new("Folder",player)
 folder.Name = "leaderstats"
 local currency1 = Instance.new("IntValue",folder)
 currency1.Name = "Cash"
 player.CharacterAdded:connect(function(character)
  character:WaitForChild("Humanoid").Died:connect(function()
  local tag = character.Humanoid:FindFirstChild("creator")
   if tag ~= nil then
    if tag.Value ~= nil then
     currency1.Value = currency1.Value + 10 --This is the reward after the 
player died.
    end
   end
  end)
 end)
end)

Thanks in advance and I hope you guys can help!

1
No its not its by me. That question was wrong and it didn't work and it wasn't answered. - user8891469

1 Answers

0
votes

There's no way to determine that player A killed player B without keeping track of that information manually.

For example, if player A shoots a gun, the bullet that it spawns could have an added ObjectValue with a Value of player A's humanoid.

When the bullet collides with player B, you would have an easy reference back to player A and can credit them for the KO.