I tried making it so when an enemy is killed you get some XP, but it doesn't work. Here is the code.

amount = 0.1
name = "level"
if script.Parent.Enemy.Health < 1 then
	for i,v in pairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("leaderstats") then
			v.leaderstats[name].Value = v.leaderstats[name].Value + amount
		end
	end
end