I have this one problem that I don't know how to fix. I'm trying to make a script were you kill an npc and it gives you money. But it only works if you use a classic sword, and I want it to work with my custom katana.

Here's my local script inside of my npc that supposed to give you cash when you kill the npc:

local Humanoid = script.Parent.Humanoid
function PwntX_X() 
local tag = Humanoid:findFirstChild("creator") 
if tag ~= nil then 
if tag.Value ~= nil then 
local Leaderstats = tag.Value:findFirstChild("leaderstats") 
if Leaderstats ~= nil then 
Leaderstats.Cor.Value = Leaderstats.Cor.Value + 25 
wait(0.1) 
script:remove() 
end 
end 
end 
end 
Humanoid.Died:connect(PwntX_X) 

2 comments

0

uh i think you need to make the katana put the creator tag in the npc.

0

I would recommend finding the "Tag Editor" plugin and using that to verify if the tags parented to the humanoid are indeed correct to fit the specified parameters.