cr8brooo

Untitled

Feb 4th, 2018
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.14 KB | None | 0 0
  1.  
  2. local next=next
  3. local crosshairimg="http://www.roblox.com/asset?id=20457765"
  4. game:service("ContentProvider"):Preload(crosshairimg)
  5. local ready=false
  6.  
  7. local event
  8. local p=game.Players.LocalPlayer
  9. function run(pc)
  10. if event then event:disconnect() end
  11. wait(0.25)
  12. local tor=pc and pc:findFirstChild("Torso")
  13. local rs=tor and tor:findFirstChild("Right Shoulder")
  14. local ra=pc and pc:findFirstChild("Right Arm")
  15. local rac=ra:Clone()
  16. if rs then
  17. rs:Destroy()
  18. end
  19. local j=Instance.new("Weld",tor)
  20. j.Name="Aim"
  21. j.Part0=tor
  22. j.Part1=ra
  23. j.C0=CFrame.new(1.5,0.5,0)
  24. j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
  25. local s=Instance.new("HopperBin",p.Backpack)
  26. s.Name="Limb Launcher"
  27. local g=Instance.new("ScreenGui",p.PlayerGui)
  28. g.Name="Crosshair no target"
  29. local img1=Instance.new("ImageLabel",g)
  30. img1.Name="IMG"
  31. img1.Size=UDim2.new(0,210,0,210)
  32. img1.Position=UDim2.new(0,0,0,0)
  33. img1.BackgroundTransparency=1
  34. img1.Visible=false
  35. img1.Image=crosshairimg
  36. local ch=Instance.new("BillboardGui",p.PlayerGui)
  37. ch.Name="Crosshair on target"
  38. ch.Size=UDim2.new(0,210,0,210)
  39. ch.AlwaysOnTop=true
  40. ch.Enabled=false
  41. local img2=Instance.new("ImageLabel",ch)
  42. img2.Name="IMG"
  43. img2.Size=UDim2.new(1,0,1,0)
  44. img2.BackgroundTransparency=1
  45. img2.Image=crosshairimg
  46. local status=Instance.new("TextLabel",g)
  47. status.Name="Status"
  48. status.Size=UDim2.new(0,100,0,25)
  49. status.Position=UDim2.new(0,110,1,-85)
  50. status.Text=""
  51. status.FontSize=Enum.FontSize.Size14
  52. status.BackgroundColor=BrickColor.new("Really black")
  53. status.TextColor=BrickColor.new("Institutional white")
  54. status.BorderSizePixel=0
  55.  
  56. local shot=false
  57. event=s.Selected:connect(function(m)
  58. local ccf
  59. local target
  60. local ftarg
  61. local hadtarget=false
  62. local unaim=false
  63. s.Parent=nil
  64. img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
  65. img1.Visible=true
  66. local aim=function()
  67. if not shot then
  68. target=nil
  69. local r=m.UnitRay
  70. local len=math.huge
  71. for _,o in next,workspace:GetChildren() do
  72. local fh=false
  73. for _,hum in next,o:GetChildren() do
  74. if hum.ClassName=="Humanoid" then
  75. fh=true
  76. break
  77. end
  78. end
  79. if o~=pc and fh then
  80. local h=o:findFirstChild("Head") or o:findFirstChild("Torso")
  81. if h and h.ClassName=="Part" then
  82. local cp=r:ClosestPoint(h.Position)
  83. local d=(h.Position-cp).magnitude/(cp-r.Origin).magnitude
  84. if d<=0.125 and d<=len then
  85. target=h
  86. len=d
  87. end
  88. end
  89. end
  90. end
  91. if target then
  92. local pos=tor.CFrame:pointToObjectSpace(target.Position)
  93. j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
  94. if target~=hadtarget then
  95. --print("Target acquired: ",target)
  96. hadtarget=target
  97. img1.Visible=false
  98. ch.Adornee=target
  99. ch.Enabled=true
  100. end
  101. status.Text="["..math.floor(pos.magnitude).."]"
  102. elseif not target then
  103. local pos=tor.CFrame:pointToObjectSpace((m.hit or tor.CFrame*CFrame.new(1.5,0.5,1)).p)
  104. j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
  105. img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
  106. if hadtarget then
  107. --print("Target lost")
  108. hadtarget=false
  109. ch.Enabled=false
  110. ch.Adornee=nil
  111. img1.Visible=true
  112. end
  113. status.Text=math.floor(pos.magnitude)
  114. end
  115. end
  116. end
  117.  
  118. local ev1=m.Move:connect(function() unaim=aim() end)--move arm and check for nearby targets
  119. local ev2=m.Button1Down:connect(function()--shoot at target
  120. unaim=aim()--returns nothing, but makes the continuous aim skip so it doesn't use up CPU for nothing
  121. ccf=tor.CFrame*j.C0*(j.C1:inverse())
  122. ftarg=target
  123. shot=true
  124. end)
  125.  
  126. repeat
  127. local ora=ra
  128. repeat--continuous aim
  129. if unaim then
  130. aim()
  131. else
  132. unaim=true
  133. end
  134. wait()
  135. until shot
  136. j:Destroy()
  137. local cccf=ccf
  138. local ltarg=ftarg
  139. local explode=false
  140. local v=Instance.new("BodyVelocity",ora)
  141. local b=Instance.new("BodyGyro",ora)
  142. b.maxTorque=Vector3.new(1e7,1e7,1e7)
  143. local function point(vel,cf)
  144. local x,y,z,xx,yx,zx,xy,yy,zy,xz,yz,zz=cf:components()
  145. v.velocity=-Vector3.new(yx,yy,yz)*vel
  146. b.cframe=cf
  147. end
  148. local v=0
  149. coroutine.resume(coroutine.create(function()
  150. local last=ora.Position
  151. repeat
  152. v=v+0.2
  153. if ltarg then
  154. local x,y,z,xx,yx,zx,xy,yy,zy,xz,yz,zz=CFrame.new(Vector3.new(0,0,0),ltarg.Position-ora.Position):components()
  155. point(v,CFrame.new(0,0,0, xx,zx,-yx, 0,zy,yy, xz,zz,-yz))
  156. else
  157. point(v,cccf)
  158. end
  159. last=ora.Position
  160. wait()
  161. until explode or not (ora and ora.Parent==workspace)
  162. local exp=Instance.new("Explosion",workspace)
  163. exp.Position=last
  164. exp.BlastRadius=v/6
  165. if ltarg then
  166. for _,ff in next,ltarg.Parent:GetChildren() do
  167. local fie=ff.ClassName=="ForceField" and ff or ff:findFirstChild("ForceField")
  168. if fie then
  169. fie:Destroy()
  170. end
  171. end
  172. end
  173. end))
  174. ora.Name = "Vroom Vroom going to hit yo face!"
  175. coroutine.resume(coroutine.create(function()
  176. local f=Instance.new("Fire",ora)
  177. f.Name="Fiar"
  178. f.Size=0.49
  179. wait(1)
  180. ora.Touched:connect(function(h)
  181. if (h==ltarg or not (ltarg and workspace:IsAncestorOf(ltarg))) and not (pc and pc.Parent==workspace and h:IsDescendantOf(pc)) and not (h:findFirstChild("Fiar") and h.Fiar.Size==0.49) and h.Name ~= "Vroom Vroom going to hit yo face!" then
  182. explode=true
  183. ora:Destroy()
  184. end
  185. end)
  186. end))
  187. ora.Parent=workspace
  188. ra=rac:Clone()
  189. ra.Parent=pc
  190. j=Instance.new("Weld",tor)
  191. j.Name="Aim"
  192. j.Part0=tor
  193. j.Part1=ra
  194. j.C0=CFrame.new(1.5,0.5,0)
  195. j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
  196. shot=false
  197. until not (pc and pc.Parent==workspace or not (p and p.Parent==game.Players)) and not (ra and ra:IsDescendantOf(workspace))
  198. ev1:disconnect()
  199. ev2:disconnect()
  200. end)
  201. end
  202.  
  203. if p.Character then
  204. run(p.Character)
  205. end
Add Comment
Please, Sign In to add comment