Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Detect by which tool a player has been killed?

Asked by 3 years ago

so i am making a pvp game and there are gonna be different tools, i am struggling to figure out how to know with which tool the player has been killed since different weapon will give different coins. here is the snipit of kill detect script

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(character)
        character.Humanoid.Died:Connect(function()
            local tag = character.Humanoid:FindFirstChild("creator")
            if tag ~= nil then
                local player = tag.Value    
                local leaderstats = player:WaitForChild("leaderstats")
                    leaderstats.Cash.Value += 5
                    leaderstats.Kills.Value += 1                
            end
        end)
    end)
end)

any help/suggestion would be appriciated!

Answer this question