biljana675

Biljana675 Limb Launcher

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