I am just thinking how if possible could you check a player to see who they killed. If someone has a wiki link to something that would be good. When I find out I plan on making something that changes a value if a playeri s on blue or red
✓ ANSWER ACCEPTED
How can I check who killed a player?
1 answer
✓ Accepted answer
This Answer actually does answer your question.
If you're not using a single damage-handling Module or function to catch deaths, your best bet is to 'tag' damage using an ObjectValue that 'points' to the source of that damage.
part.Touched:connect(function(part)
if not part.Parent:FindFirstChild("Humanoid") then return end
if game.Players.LocalPlayer.Character == hit.Parent then return end
if part.Parent.Humanoid:FindFirstChild("creator") then
part.Parent.Humanoid.creator:Destroy()
end
local tag = Instance.new("ObjectValue", part.Parent.Humanoid)
tag.Value = game.Players.LocalPlayer
tag.Name = "creator"
hit.Parent.Humanoid:TakeDamage(5)
game.Debris:AddItem(tag, 1)
end)
This code is an old style of registering bullet hits, and doesn't work with Filtering enabled, but I digress.
If you consistently use 'creator' tags in the same way as above, you can do something like this:
local BlueScore = 0
local RedScore = 0
game.Player.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid")
character.Humanoid.Died:connect(function()
if character.Humanoid:FindFirstChild("creator") then
local tag = character.Humanoid.creator
local tColor = player.TeamColor
local kColor = tag.Value.TeamColor
if not kColor then return end
if not tColor then return end
if tColor ==kColor then
--Teamkill!
if kColor == BrickColor.new("Bright red") then
RedScore = RedScore - 1
elseif kColor == BrickColor.new("Bright blue") then
BlueScore = BlueScore - 1
end
else
if kColor == BrickColor.new("Bright red") then
RedScore = RedScore + 1
elseif kColor == BrickColor.new("Bright blue") then
BlueScore = BlueScore + 1
end
end
end
end
end)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
https://scriptinghelpers.org/questions/8528/how-can-you-tell-if-player1-killed-player2#11062
that didn't answer my question... that was doing on player touched, I wanna know when a player kills a player what team they are on... so if blue player kills red player then give a value called BlueVal +1 score
Isn't this concept sort of similar to ROBLOX's Leaderboard Script? Try checking out the source code for that and modify the values to your fitting.