Npc Kill = Cash Script Wont Work

local Humanoid = script.Parent.Humanoid
function died()
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.ShadowCoin.Value = leaderstats.ShadowCoin.Value +10

That’s the script and well when I kill one of my ai nothing happens to my cash (ShadowCoin) anything wrong with the script any help appreciated :slight_smile:

No Errors
The Character Is Just My Humanoid The Other Scripts In It Are Not Relavant As The Same Result Happens With An Empty Rig.
I Use a Sword Tool I Made To Kill It
It Takes Damage and Dies Just Does not give cash

You didnt really give so much information at all, but here are the questions:

  1. Was there any errors in the output?
  2. How does the script for attacking a npc you did even work? Because we need to know how the creator tag even was there.

And a thnig I noticed is that you are using a deprecated thing which is :Remove(), plus removing the script is not a good idea.

Right i thought i edited it il fix that rq

we Don’t have much work so we can’t understand wut about just putting a value on the NPC and when hit it will put player name and when it dies it will fire a Remote event Which gives them the money.

Oh Thanks! I will try to figure out how to do that

1 Like

image I Got The Value Thing Working The Players User Goes Onto the String Value But the Second part Not so much. Showed you the scripts with names and what the explorer looks like. Please Help If they is anymore images you need just ask

Once You get the name of the player name loop through the player list and find the person and add the amt example

for _, v in pairs(game.Players:GetChildren()) do
 local player =  v:FindFirstChild(put the value name)
  --add the points.

This haven’t been tested but tell me if something goes wrong