How do I make a npc add xp when killed

How do I make an npc add xp when killed

My xp script (in server script service) uses int values to store all the variables. The script to add xp when I kill the npc (stored in the npc model) does not work and I don’t know why.

1 Like

The standard practice is when the Player hits an NPC with a weapon or projectile, you add a “creator” tag with the players name in. When the NPC dies, you check the tag and give the points to the correct player.
I think the Roblox Sword has the right basic scripts to help you do this:

1 Like

That is already shown in the second picture

This video has the solution, make sure to not skip any part in the video as it has some useful information!

1 Like

Thanks for the solution. It works.

1 Like