I am trying to figure out how to award points for killing, but I do not know how to check for the killer, I only know how to check for the one that has been killed, this is what I have tried so far:
function awardpoints(player,points)
if player and points then
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local pointsvalue = leaderstats:FindFirstChild("Points")
if pointsvalue then
pointsvalue.Value = pointsvalue.Value + points
end
end
end
end
function awardexp(player,exp)
if player and exp then
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local expvalue = leaderstats:FindFirstChild("exp")
if expvalue then
expvalue.Value = expvalue.Value + exp
end
end
end
end
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value then
local KillerTag = character:FindFirstChild("KillerTag")
if KillerTag then
awardpoints(player,50)
awardexp(player,100)
else
awardpoints(player,-500)
awardexp(player,-1000)
end
end
end
end)
end)
end)
This code rewards the player that got killed instead of the player that killed, there seems to be nothing wrong with the first two functions. Also it gives the right amount to the correlating person, but affects the one that got killed.

2 comments
I'd recommend this, when you call for awardpoints you are setting the one awarded to the player, rather it should be the one who killed. Do this by changing this to awardpoints(tag.Value). Hope this helps!
@Garfanzo It worked, thank you.