If I have an npc, and when it dies, I want it to give cash, what would I add to my script? Here is my script:
function onDied()
pose = "Dead"
Delay(5, function()
if script.Parent.Respawn.Value == true then
CheckSpawns(Workspace)
local Spawn = SpawnModel:GetChildren()
Clone.Parent = game.Workspace
if #Spawn > 0 then
Spawn = Spawn[math.random(1, #Spawn)].Value
Clone:MoveTo(Spawn)
else
Clone:MoveTo(Vector3.new(0, 50, 0))
end
end
Figure:Remove()
return
end)

2 comments
You'll need to figure out which player killed it, so if its a gun, have a function called when a remote even is fired from the player shooting. After shooting, have the server script check if the NPC is there and then damage the NPC. If the NPC's health is 0 then Cash = Cash + Amount.
Ill see if this works