Hi. I made a combat game, and i want to save the money a player makes every time he kills. I have tried some scripts, and i made some but none of them work. I hope you can help me
heres the cash for kill script:
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local cash = Instance.new("IntValue",leaderstats)
cash.Name = "Pejecoins"
cash.Value = 0
local kills = Instance.new("IntValue",leaderstats)
kills.Name = "Weyes Torcidos"
kills.Value = 0
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local CreatorTag = character.Humanoid:FindFirstChild("creator")
if CreatorTag and CreatorTag.Value then
local stats = CreatorTag.Value:WaitForChild("leaderstats")
stats["Pejecoins"].Value = stats["Pejecoins"].Value + 150
stats["Weyes Torcidos"].Value = stats["Weyes Torcidos"].Value + 1
end
end)
end)
end)
EDIT: Nvm, i found how to
