How do i check what caused the death of a player

im making a two player tower defense game.
im trying to give the appropiate player the rewards when killing a mob.
ive read about creator tags but im pretty sure that they can only be used when a tools kills the player, in this case its not a tool but a turret.
is this possible?

nvm, i fixed it.
when the turret damages the mob, it checks if the health is less than 1 and if it is then it creates a string value in the mob with the player’s name as the value.
then when the mob dies it finds the player using the username given

when the turret is created a string value is inserted inside with the value being the player’s username

in the turret’s script

if target.Humanoid.Health < 1 or nil then
local killer = Instance.new(“StringValue”, target)
killer.Name = “Killer”
killer.Value = defense.Creator.Value
end

in the mob’s script

mob.Humanoid.Died:Connect(function()
local reward = Mob.killRewards[mob.Name]

game.Players[mob:WaitForChild(“Killer”).Value].leaderstats.Money.Value += reward

task.wait(0.5)
mob:Destroy()
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.