When the NPC dies it tags the player that is responsible for the NPCs death but it isn't working. Can someone please help me! I've tried for hours but I'm still not able to find a solution to this.
Script:
local playerHumanoid = script.Parent.Humanoid;
local function npcKilled()
local tag = playerHumanoid:FindFirstChild("creator");
if(tag) and (tag.Value) ~= nil then
local moveTo = game.Players[tag.Value]:FindFirstChild("PlayerGui")
if(moveTo) then
local cloneGui = script.KillnoteGui:Clone();
cloneGui.Parent = moveTo;
wait(0.1)
script:Destroy();
end
end
end
playerHumanoid.Died:connect(npcKilled);

1 comment
You need to use RemoteEvents for this to work. Make it so that after the npc is killed to fire a client event which then inserts the local script into the clients PlayerGui