This kills the player when the part that shoots hits the player that has the gun.
Part.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 5 Part:Destroy() else if hit.Name == "Head" then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 5 *1.25 Part:Destroy() end end end)
Add an "owner" variable to signify the creator of the part.(player that shot the gun) This variable must be created and set earlier in the script.
Part.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent.Name == owner.Name then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 5 Part:Destroy() else if hit.Name == "Head" and not hit.Parent.Name == owner.Name then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 5 *1.25 Part:Destroy() end end end)