I have an NPC that I want to give xp to a player upon its death. Sadly, I cant seem to tag the player who kills it with a normal script, but the npc wont work in a local script, any ideas?
local Target = script.Parent.Target
local enemy = script.Parent.Parent
local RS = script.Parent["Right Shoulder"]
local LL = script.Parent["Left Hip"]
local RL = script.Parent["Right Hip"]
Punching = false
function Walk(Part)
if enemy.Humanoid.Sit == true then
enemy.Humanoid.Sit = false
end
for repititions = 1, 20 do
for pose1 = 1,10 do
LL.C0 = LL.C0 *CFrame.Angles(0, 0, 0.1)
RL.C0 = RL.C0 *CFrame.Angles(0, 0, 0.1)
wait(0.1)
end
for pose2 = 1,10 do
LL.C0 = LL.C0 *CFrame.Angles(0, 0, -0.1)
RL.C0 = RL.C0 *CFrame.Angles(0, 0, -0.1)
wait(0.1)
end
end
end
function Chase(Part)
if Part.Parent:FindFirstChild("Humanoid") ~= nil then
Target.Value = Part.Parent.Name
for chasing = 1,400 do
if chasing == 10 or chasing == 20 or chasing == 30 or chasing == 100 or chasing == 130 or chasing == 200 then
local x = Instance.new("Part")
x.BrickColor = BrickColor.new("White")
x.Material = "Neon"
x.CanCollide = false
x.Transparency = 0.6
x.Size = Vector3.new(8,8,8)
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Shape = "Ball"
x.Parent = Workspace
local fd = script.fireDamage:clone()
fd.Parent = x
local a = Instance.new("Sound")
a.SoundId = "http://www.roblox.com/asset/?id=260430117"
a.Parent = x
a.Volume = 2
a.Pitch = 1.3
a:play()
local effect = game.ServerStorage.Effects.NpcPunch1.Effect:clone()
effect.Parent = x
local light = game.ServerStorage.Effects.NpcPunch1.Light:clone()
light.Parent = x
local y = Instance.new("BodyVelocity")
y.maxForce = Vector3.new(math.huge ,math.huge ,math.huge)
y.velocity = enemy.Torso.CFrame.lookVector*115
x.CFrame = enemy.Torso.CFrame*CFrame.new(0, 1 , -10)
x.Parent = Workspace
y.Parent = x
game.Debris:AddItem(x, 6)
end
if Punching == false then
enemy.Humanoid:MoveTo(Part.Parent.Torso.Position,Part.Parent.Torso)
end
wait(0.5)
end
end
end
function Punch(Part)
if Punching == false and Part.Parent:FindFirstChild("Humanoid") ~= nil then
Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health - 60
local v = Instance.new("BodyVelocity")
game.Debris:AddItem(v, 1)
Part.Parent.Humanoid.Sit = true
v.Parent = Part.Parent.Torso
v.Velocity = enemy.Torso.CFrame.lookVector *50
v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
Punching = true
for RSLOOP = 1,10 do
RS.C0 = RS.C0 * CFrame.Angles(0, 0, 0.25)
wait(0.1)
end
for RSLOOP = 1,10 do
RS.C0 = RS.C0 * CFrame.Angles(0, 0, -0.25)
wait(0.1)
end
Punching = false
end
end
script.Parent.Touched:connect(Punch)
script.Parent.Touched:connect(Chase)
script.Parent.Touched:connect(Walk)

3 comments
Just looking at the length of the script, a majority of people won't take the time to even look. State the line numbers where you need help.
You actually can tag the player who killed it with a normal script. Use a RemoteEvent to create the tag on the server.
I don't need help in a certain part of the script, it's just there incase someone needed to look it over to help. And I'll be sure to check into using a RemoteEvent, thanks!