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)
When the NPC Dies find the player which you have first get the weapons parent when npc died(character) then get the player from character(game.Players:GetPlayerFromCharacter(character)) then add cash to it but make sure you have leaderstats so they can get cash