Inside of my leaderstats script there is a function that gives gems upon kill, however, it seems not to give gems on the second kill and I was wondering if anyone knew why. Below I have attached the function script of the gems that should be added upon a kill, and a video of the issue.
Player.CharacterAdded:Connect(function()
local Humanoid = Player.Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
print("died")
Player:SetAttribute("Team",nil)
local DamageDealer = Humanoid:FindFirstChild("creator")
if DamageDealer and DamageDealer.Value then
local Killer = game.Players:FindFirstChild(DamageDealer.Value.Name)
if Killer and Killer.leaderstats then
local Gems = Killer.leaderstats:FindFirstChild("Gems")
if Gems then
local multiplier = 1
if Killer.leaderstats:FindFirstChild("Wins") then
local winsValue = Killer.leaderstats.Wins.Value
if winsValue >= 10 then
multiplier = 1.35
end
if winsValue >= 25 then
multiplier = 1.5
end
if winsValue >= 50 then
multiplier = 2
end
if winsValue >= 75 then
multiplier = 2.55
end
if winsValue >= 100 then
multiplier = 3
end
if winsValue >= 125 then
multiplier = 3.25
end
if winsValue >= 150 then
multiplier = 3.7
end
if winsValue >= 175 then
multiplier = 4.1
end
end
local ownsVIP = marketplaceService:UserOwnsGamePassAsync(Killer.UserId, 793729840)
if ownsVIP == true then
print(ownsVIP)
multiplier += 1.5
end
local owns2xGems = marketplaceService:UserOwnsGamePassAsync(Killer.UserId, 793815770)
if owns2xGems == true then
print(owns2xGems)
multiplier += 2
end
local groupMulti = Killer:IsInGroup(16892357)
if groupMulti == true then
print(groupMulti)
multiplier += 1.75
end
Gems.Value = (Gems.Value or 0) + 5 * multiplier
print(multiplier)
end
end
end
end)
end)
end)
In the video, it can be seen that the gems are given the first kill, but not after the second for some reason