This script is supposed to give the player to killed another player 3 money, and 1 kill. But when I kill someone else, it doesn't work. It also don't get any errors. Help?
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new("IntValue") money.Name = "Money" money.Value = 0 money.Parent = leaderstats local kills = Instance.new("IntValue") kills.Name = "Kills" kills.Value = 0 kills.Parent = leaderstats local level = Instance.new("IntValue") level.Name = "Level" level.Value = 1 level.Parent = leaderstats game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character.Humanoid.Died:connect(function() local killer = character.Humanoid:findFirstChild("creator") if killer then killer.leaderstats.Kills.Value = killer.Value.Kills.Value + 1 killer.leaderstats.Money.Value = killer.leaderstats.Money.Value + 3 end end) end) end) end)
You're using the PlayerAdded event twice. The second one isn't loading. Additionally, this should be in a severscript if it isn't already.
game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("Model") leaderstats.Name = "leaderstats" leaderstats.Parent = player local money = Instance.new("IntValue") money.Name = "Money" money.Value = 0 money.Parent = leaderstats local kills = Instance.new("IntValue") kills.Name = "Kills" kills.Value = 0 kills.Parent = leaderstats local level = Instance.new("IntValue") level.Name = "Level" level.Value = 1 level.Parent = leaderstats player.CharacterAdded:connect(function(character) character.Humanoid.Died:connect(function() local killer = character.Humanoid:findFirstChild("creator") if killer then killer.leaderstats.Kills.Value = killer.Value.Kills.Value + 1 killer.leaderstats.Money.Value = killer.leaderstats.Money.Value + 3 end end) end) end)