im Trying to make it when a player kills a npc, it triggers a event to the player that killed the npc
it dosen’t seem to work, how can i fix this issue
thanks.
local Humanoid = script.Parent:WaitForChild("Humanoid")
Humanoid.Died:connect(function()
local Killer = Humanoid:findFirstChild("creator")
if Killer ~= nil then
if Killer.Value ~= nil then
game.ReplicatedStorage:FindFirstChild("DisplayKill"):FireClient(Killer)
end
end
end)
The Value property of Killer is the reference to the player object, it seems it might’ve just been a typo.
local Humanoid = script.Parent:WaitForChild("Humanoid")
Humanoid.Died:connect(function()
local Killer = Humanoid:findFirstChild("creator")
if Killer ~= nil then
if Killer.Value ~= nil then
game.ReplicatedStorage:FindFirstChild("DisplayKill"):FireClient(Killer.Value)
end
end
end)