Advertisement
JuicyPenguin

Laser script

May 23rd, 2015
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[ Put your name where it says yourname -ulti55]]
  2.  
  3. if script.Parent.className~="HopperBin" then
  4. ma=Instance.new("HopperBin")
  5. ma.Name="Laser "
  6. --ma.Parent=game.Lighting
  7. ma.Parent=game.Players.Imtannerbanner56.Backpack
  8. script.Parent=ma
  9. end
  10.  
  11. local Selected = false
  12. local Shoot = true
  13. function Click(Target)
  14. if(Target.Target.Parent:findFirstChild("Humanoid")~=nil)then
  15. Target.Target.Parent.Humanoid.Health = 0
  16. end
  17. local P = Instance.new("Part")
  18. P.Name = "Laser"
  19. local Place0 = script.Parent.Parent.Parent.Character["Left Arm"].CFrame
  20. P.formFactor = 0
  21. P.Size = Vector3.new(1,1,(Place0.p - Target.Hit.p).magnitude)
  22. P.CFrame = CFrame.new((Place0.p + Target.Hit.p)/2,Place0.p)
  23. P.Parent = game.Workspace
  24. P.Color = Color3.new(0,0,1)
  25. P.Transparency = 0.5
  26. P.Reflectance = 0.5
  27. P.Anchored = true
  28. P.CanCollide = false
  29. local E = Instance.new("Explosion")
  30. E.Position = Target.Hit.p
  31. E.Parent = game.Workspace
  32. for i = 1,10 do
  33. P.Transparency = 0.5+(i*0.05)
  34. P.Reflectance = i*0.05
  35. wait(0.1)
  36. end
  37. P:Rremove()
  38. end
  39. function Select(Mouse)
  40. local Arm = script.Parent.Parent.Parent.Character:findFirstChild("Left Arm")
  41. if(Arm==nil)then
  42. script.Parent:Remove()
  43. script:Remove()
  44. end
  45. Selected = true
  46. local Torso = script.Parent.Parent.Parent.Character:findFirstChild("Torso")
  47. if(Torso==nil)then
  48. script.Parent:Remove()
  49. script:Remove()
  50. end
  51. local ArmWeld = Torso:findFirstChild("Left Shoulder")
  52. if(ArmWeld~=nil)then
  53. ArmWeld.Parent = nil
  54. end
  55. Mouse.Button1Down:connect(function()Click(Mouse)end)
  56. Arm.Anchored = true
  57. while Selected do
  58. local Place0 = script.Parent.Parent.Parent.Character.Torso.CFrame
  59. Place0 = Place0 + ((Place0 * CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)).lookVector * 0.5) + (Place0 * CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)).lookVector
  60. local Place1 = Place0 + ((Place0.p-Mouse.Hit.p).unit * -2)
  61. Arm.CFrame = CFrame.new((Place0.p + Place1.p)/2,Place0.p) * CFrame.fromEulerAnglesXYZ(-math.pi/2,0,0)
  62. wait()
  63. end
  64. Arm.Anchored = false
  65. if(ArmWeld~=nil)then
  66. ArmWeld.Parent = Torso
  67. end
  68. end
  69. function Deselect()
  70. Selected = false
  71. end
  72. script.Parent.Selected:connect(Select)
  73. script.Parent.Deselected:connect(Deselect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement