Advertisement
Guest User

NPC Script

a guest
Dec 16th, 2023
1,157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1.  
  2. local clone = game.ReplicatedStorage:WaitForChild("Clone")
  3.  
  4. local NPC = script.Parent
  5.  
  6. local Humanoid = script.Parent.Humanoid
  7.  
  8. function Dead()
  9. local tag = Humanoid:FindFirstChild("creator")
  10. if tag ~= nil then
  11. local leaderstats = tag.Value:FindFirstChild("leaderstats")
  12. if leaderstats ~= nil then
  13.  
  14. leaderstats.Parent.Exp.Value = leaderstats.Parent.Exp.Value + 10
  15. leaderstats.Money.Value = leaderstats.Money.Value + 100
  16. leaderstats.KillStreak.Value = leaderstats.KillStreak.Value + 1
  17.  
  18. wait (0.1)
  19.  
  20. local position = NPC.HumanoidRootPart.Position
  21. NPC:Destroy()
  22. wait(5)
  23. -- create a clone of the npc
  24. clone:Clone().Parent = game.Workspace
  25. clone.HumanoidRootPart.Position = position
  26.  
  27. script:Remove()
  28.  
  29. end
  30.  
  31. end
  32.  
  33. end
  34. Humanoid.Died:Connect(Dead)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement