Advertisement
Guest User

Untitled

a guest
Dec 12th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.11 KB | None | 0 0
  1. -- This is local
  2.  
  3. local player = game.Players.LocalPlayer
  4. local mouse = player:GetMouse()
  5. local bin = Instance.new("HopperBin", player.Backpack) -- just to keep the friend request thing off
  6. bin.Name = "Turret"
  7.  
  8. local cannon = false
  9. local char = player.Character
  10. local T = char:findFirstChild("Torso")
  11. local RA = char:findFirstChild("Right Arm")
  12. local LA = char:findFirstChild("Left Arm")
  13. local RS = T:findFirstChild("Right Shoulder")
  14. local LS = T:findFirstChild("Left Shoulder")
  15. local new = player.Character.Head:clone()
  16. new.Name = "Fakehead"
  17. new.Anchored = true
  18. new.CanCollide = false
  19.  
  20. local color = {"Lime green", "Really red", "Really blue", "Really black", "Institutional white", "Hot pink", "Toothpaste", "New Yeller"}
  21. color = BrickColor.new(color[math.random(1, #color)])
  22.  
  23. Delay(0, function()
  24. local hats = {}
  25. local CFs = {}
  26. local Ds = {}
  27. for _, v in ipairs(player.Character:GetChildren()) do
  28. if v:IsA("Accoutrement") then
  29. local h = v:findFirstChild("Handle")
  30. if h then
  31. if h:GetMass() < 20 then
  32. h.Transparency = 1
  33. h = h:clone()
  34. h.Transparency = 0
  35. h.Anchored = true
  36. h.Parent = player.Character
  37. pcall(function()
  38. table.insert(hats, h)
  39. local look = CFrame.new(player.Character.Head.Position, h.Position)
  40. local X,Y,Z = look:toEulerAnglesXYZ()
  41. table.insert(CFs, CFrame.Angles(X,Y,Z))
  42. table.insert(Ds, (player.Character.Head.Position - h.Position).magnitude)
  43. end)
  44. end
  45. end
  46. end
  47. end
  48. Delay(0, function()
  49. repeat wait(.5) until cannon
  50. if cannon then
  51. RS.Parent = nil
  52. LS.Parent = nil
  53. RA.Anchored = true
  54. LA.Anchored = true
  55. end
  56. end)
  57. player.Character.Head.Transparency = .9
  58. local face = player.Character.Head.face
  59. face.Parent = nil
  60. function Move()
  61. new.Parent = player.Character
  62. new.Anchored = false
  63. local W = new:findFirstChild("Weld") or Instance.new("Weld", new)
  64. W.Part0 = new
  65. W.Part1 = player.Character.Head
  66. local cf = CFrame.new(player.Character.Head.Position, mouse.Hit.p)
  67. W.C0 = cf:inverse()
  68. W.C1 = player.Character.Head.CFrame:inverse()
  69. for _, v in ipairs(hats) do
  70. local w = v:findFirstChild("Weld") or Instance.new("Weld", v)
  71. w.Part0 = v
  72. w.Part1 = new
  73. local cf = new.CFrame + (new.CFrame*CFs[_]).lookVector*Ds[_]
  74. w.C0 = cf:inverse()
  75. w.C1 = new.CFrame:inverse()
  76. v.Anchored = false
  77. end
  78. end
  79. Move()
  80. player.Character.Torso.Changed:connect(function() Move() end)
  81. Delay(0, function()
  82. while true do
  83. local TP1 = player.Character.Torso.Position + player.Character.Torso.CFrame.lookVector*100
  84. local TP2 = player.Character.Torso.Position + CFrame.new(player.Character.Torso.Position, mouse.Hit.p).lookVector*100
  85. TP2 = TP2*Vector3.new(1,0,1) + TP1*Vector3.new(0,1,0)
  86. if cannon then
  87. RS.Parent = nil
  88. LS.Parent = nil
  89. RA.Anchored = true
  90. LA.Anchored = true
  91. local Place0 = T.CFrame
  92. local H1 = hp1x and hp1 or mouse.Hit.p
  93. local H2 = hp2x and hp2 or mouse.Hit.p
  94. Place0 = Place0 + ((Place0*CFrame.Angles(math.pi/2,0,0)).lookVector * 0.5) + (Place0*CFrame.Angles(0,math.pi/2,0)).lookVector*1.5
  95. local Place1 = Place0 + ((Place0.p-H1).unit*-2)
  96. RA.CFrame = CFrame.new((Place0.p + Place1.p)/2,Place0.p) * CFrame.Angles(-math.pi/2,0,0)
  97. local Place0 = T.CFrame
  98. Place0 = Place0 + ((Place0*CFrame.Angles(math.pi/2,0,0)).lookVector * 0.5) - (Place0*CFrame.Angles(0,math.pi/2,0)).lookVector*1.5
  99. local Place1 = Place0 + ((Place0.p-H2).unit*-2)
  100. LA.CFrame = CFrame.new((Place0.p + Place1.p)/2,Place0.p) * CFrame.Angles(-math.pi/2,0,0)
  101. T.CFrame = CFrame.new(T.Position, TP1:lerp(TP2, ((TP1-TP2).magnitude^(1/1.5) - 20)/100)*Vector3.new(1,0,1) + T.Position*Vector3.new(0,1,0))
  102. else
  103. sHand = nil
  104. RS.Parent = T
  105. LS.Parent = T
  106. RA.Anchored = false
  107. LA.Anchored = false
  108. T.CFrame = CFrame.new(T.Position, TP1:lerp(TP2, ((TP1-TP2).magnitude^(1/1.5) - 10.8)/100)*Vector3.new(1,0,1) + T.Position*Vector3.new(0,1,0))
  109. end
  110. wait()
  111. end
  112. end)
  113. end)
  114.  
  115. local click = 0
  116. Delay(0, function()
  117. while wait(.5) do
  118. cannon = (click ~= 0)
  119. end
  120. end)
  121.  
  122. mouse.Button1Down:connect(function()
  123. if mouse.Target then
  124. cannon = true
  125. click = click + 1
  126. Delay(.5, function() click = math.max(click-1, 0) end)
  127. local part = Instance.new("Part")
  128. part.Anchored = true
  129. part.CanCollide = false
  130. part.FormFactor = "Custom"
  131. part.TopSurface, part.BottomSurface = "Smooth", "Smooth"
  132. part.BrickColor = color
  133. local p1, p2 = part:clone(), part:clone()
  134. p1.Parent, p2.Parent = player.Character, player.Character
  135. p1.Size = Vector3.new(.3,.3,1.5)
  136. p2.Size = Vector3.new(.3,.3,1.5)
  137. p1.CFrame = RA.CFrame
  138. p2.CFrame = LA.CFrame
  139. local C = mouse.Hit.p
  140. local targ = mouse.Target
  141. local CTDist = (C-targ.Position).magnitude
  142. local RA1, LA1 = RA.Position, LA.Position
  143. local Touched = false
  144. local damage = function(hit)
  145. if hit.Parent ~= player.Character and hit.Parent.Parent ~= player.Character then
  146. pcall(function()
  147. local h = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
  148. if h then
  149. h.MaxHealth = math.min(1e10, math.max(h.MaxHealth, 1))
  150. h:TakeDamage(h.MaxHealth*math.random(1,300)/1000)
  151. end
  152. end)
  153. Touched = true
  154. end
  155. end
  156. p1.Touched:connect(damage)
  157. p2.Touched:connect(damage)
  158. local targ = mouse.Target
  159. local diff = (targ.Position - C).magnitude
  160. for i = 0, 1, 1/(player.Character["Torso"].Position - C).magnitude*4 do
  161. if not Touched then
  162. p1.CFrame = CFrame.new(RA1:lerp(C, i), C)
  163. p2.CFrame = CFrame.new(LA1:lerp(C, i), C)
  164. wait()
  165. end
  166. end
  167. if targ then
  168. if math.abs((targ.Position - C).magnitude - diff) < 5 then
  169. damage(targ)
  170. end
  171. end
  172. for i = 0, 1, 1/10 do
  173. wait()
  174. local x1, x2 = p1.CFrame, p2.CFrame
  175. p1.Size = p1.Size + Vector3.new(.2,.2,.2)
  176. p2.Size = p1.Size
  177. p1.CFrame = x1*CFrame.Angles(math.random(0, 100), math.random(0, 100), math.random(0, 100))
  178. p2.CFrame = x2*CFrame.Angles(math.random(0, 100), math.random(0, 100), math.random(0, 100))
  179. p1.Transparency = i
  180. p2.Transparency = i
  181. end
  182. p1:Destroy()
  183. p2:Destroy()
  184. end
  185. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement