You can use a debounce to stop the code from running multiple times:
local players = game:GetService("Players")
local player = players.LocalPlayer
local enemy = -- Path to your enemy
local debounce = false
local cooldown = 1
enemy.Humanoid.Died:Connect(function()
if enemy:FindFirstChild("ExpGain") then
if debounce == false then
debounce = true
player.Stats.Exp.Value += enemy:FindFirstChild("IsAnNpc").Value
task.wait(cooldown)
debounce = false
end
end
end)