Basically what I would do is, is whenever the player attacks the monster using the sword have the sword create a StringValue with the players name in it that way whenever the monster dies it knows to give credit to the player also including some sort of NumberValue that tracks how much damage so seeing if the player did so much damage vs other players would be a good way to give proper credit..
also having a value inside the monster with the monsters name would be a great help in distinguishing player vs mosnter
1 | local character = script.Parent.Parent |
2 | script.Parent.Touched:connect( function (hit) |
3 | if hit.Parent:FindFirstChild( "MonsterValue" ) then |
4 | local val = Instance.new( "StringValue" , hit.Parent) |
5 | val.Value = game.Players:GetPlayerFromCharacter(character).Name |
hope this helps you understand it a bit better