Save System / Script Question!?

Good day i am started before a few days whit Core, and i made a Save / XP System whit the help of a few Youtube Videos its Ads Xp when i kill somony(In Script Makerd whit --------------------------------------)For Scipt See down bellow. But i want to add xp to the player when its kill a mob i made the mobs whit NPC AI KIT from Comunity Content.
What can i do to make this?

Thanks to all in advance.

"""
function OnPlayerJoined(player)
local data = Storage.GetPlayerData(player)
local xp = data["xp"] or 0
local level = data["level"] or 1
local reqxp = data["reqxp"] or 120

reqxp = 100 *  1.20 ^ level

reqxp = CoreMath.Round(reqxp)

player:SetResources("xp", xp)
player:SetResources("level", level)
player:SetResources("reqxp", reqxp)

player.diedEvent:Connect(OnPlayerDied)
player.resourceChangedEvent:Connect(OnResourceChanged)

end

function OnPlayerDied(player, dmg)
player:RemoveResources("xp", 1)
local playerNewXp = player:GetResource("xp")
print(tostring(killerNewXp) .. " " .. dmg.sourcePlayer.name)

if Object.IsValid(dmg.sourcePlayer) then
dmg.sourcePlayer:AddResources("xp", 10)
local killerNewXp = dmg.sourcePlayer:GetResource("xp")
print(tostring(killerNewXp) .. " " .. dmg.sourcePlayer.name)
end
end

function OnDataSave(player)
local data = Storage.GetPlayerData(player)
local res = player:GetResources()

for key, value in pair(res) do
	if key == "xp" then
		data[key] = value
	elseif key == "level" then 
		data[key] = value
	elseif key == "reqxp" then
		data[key] = value
	end
end

function OnResourceChanged(player, resName, resValue)
Task.wait(0.1)
if (resName == "xp") then
local data = Storage.GetPlayerData(player)
local xp = resValue
local level = player:GetResources("level")
local reqxp = 100 * 1.20 ^ level

	reqxp = CoreMath.Round(reqxp)
	print(player.name .. level)
	print(reqxp .. " " .. level)
	if xp >= reqxp then
	local xp = xp - reqxp
	level = level +1
	print(player.name .. level)
	
	local reqxp = 100 * 1.20 ^ level
	
	reqxp = CoreMath.Round(reqxp)
	print(reqxp .. " " .. level)
	player:SetResource("xp", xp)
	player:SetResource("level", level)
	player:SetResource("reqxp", reqxp)
	
	end
end

end

Game.playerJoinedEvent:Connect(OnPlayerJoined)
Game.playerLeftEvent:Connect(OnDataSave)

"""

There's already a template for xp gain and leveling in the RPG Framework you can port over to your game if you want to avoid the headache of scripting one from scratch.

Ok, but i want try make my own one but did you know how i can make the drops?

Like loot drops? Loot Drop Factory can handle that, or if you want loot drops with a full inventory you can get the META Inventory system. Both should be up on Community Content. Loot Drop factory is included in the RPG Framework as well.

Sorry for the many Questions but i first want to make it for testing whit a template bzw. the xp / money System how can i do this?