Advertisement
Void_scripter0

Rocket limb

Mar 21st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.38 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient()then error("Please run as a server script. Use h/ instead of hl/.")end;print("FE Compatibility: by WaverlyCole");InternalData = {}
  2. do
  3. script.Parent = owner.Character
  4. local Event = Instance.new("RemoteEvent");Event.Name = "UserInput"
  5. local function NewFakeEvent()
  6. local Bind = Instance.new("BindableEvent")
  7. local Fake;Fake = {Connections = {},
  8. fakeEvent=true;
  9. Connect=function(self,Func)
  10. Bind.Event:connect(Func)
  11. self.Connections[Bind] = true
  12. return setmetatable({Connected = true},{
  13. __index = function (self,Index)
  14. if Index:lower() == "disconnect" then
  15. return function() Fake.Connections[Bind] = false;self.Connected = false end
  16. end
  17. return Fake[Index]
  18. end;
  19. __tostring = function() return "Connection" end;
  20. })
  21. end}
  22. Fake.connect = Fake.Connect;return Fake;
  23. end
  24. local Mouse = {Target=nil,Hit=CFrame.new(),KeyUp=NewFakeEvent(),KeyDown=NewFakeEvent(),Button1Up=NewFakeEvent(),Button1Down=NewFakeEvent()}
  25. local UserInputService = {InputBegan=NewFakeEvent(),InputEnded=NewFakeEvent()}
  26. local ContextActionService = {Actions={},BindAction = function(self,actionName,Func,touch,...)
  27. self.Actions[actionName] = Func and {Name=actionName,Function=Func,Keys={...}} or nil
  28. end};ContextActionService.UnBindAction = ContextActionService.BindAction
  29. local function TriggerEvent(self,Event,...)
  30. local Trigger = Mouse[Event]
  31. if Trigger and Trigger.fakeEvent and Trigger.Connections then
  32. for Connection,Active in pairs(Trigger.Connections) do if Active then Connection:Fire(...) end end
  33. end
  34. end
  35. Mouse.TrigEvent = TriggerEvent;UserInputService.TrigEvent = TriggerEvent
  36. Event.OnServerEvent:Connect(function(FiredBy,Input)
  37. if FiredBy.Name ~= owner.Name then return end
  38. if Input.MouseEvent then
  39. Mouse.Target = Input.Target;Mouse.Hit = Input.Hit
  40. else
  41. local Begin = Input.UserInputState == Enum.UserInputState.Begin
  42. if Input.UserInputType == Enum.UserInputType.MouseButton1 then return Mouse:TrigEvent(Begin and "Button1Down" or "Button1Up") end
  43. for _,Action in pairs(ContextActionService.Actions) do
  44. for _,Key in pairs(Action.Keys) do if Key==Input.KeyCode then Action.Function(Action.Name,Input.UserInputState,Input) end end
  45. end
  46. Mouse:TrigEvent(Begin and "KeyDown" or "KeyUp",Input.KeyCode.Name:lower())
  47. UserInputService:TrigEvent(Begin and "InputBegan" or "InputEnded",Input,false)
  48. end
  49. end)
  50. InternalData["Mouse"] = Mouse;InternalData["ContextActionService"] = ContextActionService;InternalData["UserInputService"] = UserInputService
  51. Event.Parent = NLS([[
  52. local Player = owner;local Event = script:WaitForChild("UserInput");local UserInputService = game:GetService("UserInputService");local Mouse = Player:GetMouse()
  53. local Input = function(Input,gameProcessedEvent)
  54. if gameProcessedEvent then return end
  55. Event:FireServer({KeyCode=Input.KeyCode,UserInputType=Input.UserInputType,UserInputState=Input.UserInputState})
  56. end
  57. UserInputService.InputBegan:Connect(Input);UserInputService.InputEnded:Connect(Input)
  58. local Hit,Target
  59. while wait(1/30) do
  60. if Hit ~= Mouse.Hit or Target ~= Mouse.Target then
  61. Hit,Target = Mouse.Hit,Mouse.Target;Event:FireServer({["MouseEvent"]=true,["Target"]=Target,["Hit"]=Hit})
  62. end
  63. end
  64. ]],owner.Character)
  65. end
  66. RealGame = game;game = setmetatable({},{
  67. __index = function (self,Index)
  68. local Sandbox = function (Thing)
  69. if Thing:IsA("Player") then
  70. local RealPlayer = Thing
  71. return setmetatable({},{
  72. __index = function (self,Index)
  73. local Type = type(RealPlayer[Index])
  74. if Type == "function" then
  75. if Index:lower() == "getmouse" or Index:lower() == "mouse" then
  76. return function (self)return InternalData["Mouse"] end
  77. end
  78. return function (self,...)return RealPlayer[Index](RealPlayer,...) end
  79. end
  80. return RealPlayer[Index]
  81. end;
  82. __tostring = function(self) return RealPlayer.Name end
  83. })
  84. end
  85. end
  86. if RealGame[Index] then
  87. local Type = type(RealGame[Index])
  88. if Type == "function" then
  89. if Index:lower() == "getservice" or Index:lower() == "service" then
  90. return function (self,Service)
  91. local FakeServices = {
  92. ["players"] = function()
  93. return setmetatable({},{
  94. __index = function (self2,Index2)
  95. local RealService = RealGame:GetService(Service)
  96. local Type2 = type(Index2)
  97. if Type2 == "function" then
  98. return function (self,...) return RealService[Index2](RealService,...)end
  99. else
  100. if Index2:lower() == "localplayer" then return Sandbox(owner) end
  101. return RealService[Index2]
  102. end
  103. end;
  104. __tostring = function(self) return RealGame:GetService(Service).Name end
  105. })
  106. end;
  107. ["contextactionservice"] = function() return InternalData["ContextActionService"] end;
  108. ["userinputservice"] = function() return InternalData["UserInputService"] end;
  109. ["runservice"] = function()
  110. return setmetatable({},{
  111. __index = function(self2,Index2)
  112. local RealService = RealGame:GetService(Service)
  113. local Type2 = type(Index2)
  114. if Type2 == "function" then
  115. return function (self,...) return RealService[Index2](RealService,...) end
  116. else
  117. local RunServices = {
  118. ["bindtorenderstep"] = function() return function (self,Name,Priority,Function) return RealGame:GetService("RunService").Stepped:Connect(Function) end end;
  119. ["renderstepped"] = function() return RealService["Stepped"] end
  120. }
  121. if RunServices[Index2:lower()] then return RunServices[Index2:lower()]() end
  122. return RealService[Index2]
  123. end
  124. end
  125. })
  126. end
  127. }
  128. if FakeServices[Service:lower()] then return FakeServices[Service:lower()]() end
  129. return RealGame:GetService(Service)
  130. end
  131. end
  132. return function (self,...) return RealGame[Index](RealGame,...) end
  133. else
  134. if game:GetService(Index) then return game:GetService(Index) end
  135. return RealGame[Index]
  136. end
  137. end
  138. return nil
  139. end
  140. });Game = game;owner = game:GetService("Players").LocalPlayer;script = Instance.new("Script");print("Complete! Running...")
  141.  
  142. local next=next
  143. local crosshairimg="http://www.roblox.com/asset?id=20457765"
  144. game:service("ContentProvider"):Preload(crosshairimg)
  145. local ready=false
  146.  
  147. local event
  148. local p=game.Players.LocalPlayer
  149. function run(pc)
  150. if event then event:disconnect() end
  151. wait(0.25)
  152. local tor=pc and pc:findFirstChild("Torso")
  153. local rs=tor and tor:findFirstChild("Right Shoulder")
  154. local ra=pc and pc:findFirstChild("Right Arm")
  155. local rac=ra:Clone()
  156. if rs then
  157. rs:Destroy()
  158. end
  159. local j=Instance.new("Weld",tor)
  160. j.Name="Aim"
  161. j.Part0=tor
  162. j.Part1=ra
  163. j.C0=CFrame.new(1.5,0.5,0)
  164. j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
  165. local s=Instance.new("HopperBin",p.Backpack)
  166. s.Name="Limb Launcher"
  167. local g=Instance.new("ScreenGui",p.PlayerGui)
  168. g.Name="Crosshair no target"
  169. local img1=Instance.new("ImageLabel",g)
  170. img1.Name="IMG"
  171. img1.Size=UDim2.new(0,210,0,210)
  172. img1.Position=UDim2.new(0,0,0,0)
  173. img1.BackgroundTransparency=1
  174. img1.Visible=false
  175. img1.Image=crosshairimg
  176. local ch=Instance.new("BillboardGui",p.PlayerGui)
  177. ch.Name="Crosshair on target"
  178. ch.Size=UDim2.new(0,210,0,210)
  179. ch.AlwaysOnTop=true
  180. ch.Enabled=false
  181. local img2=Instance.new("ImageLabel",ch)
  182. img2.Name="IMG"
  183. img2.Size=UDim2.new(1,0,1,0)
  184. img2.BackgroundTransparency=1
  185. img2.Image=crosshairimg
  186. local status=Instance.new("TextLabel",g)
  187. status.Name="Status"
  188. status.Size=UDim2.new(0,100,0,25)
  189. status.Position=UDim2.new(0,110,1,-85)
  190. status.Text=""
  191. status.FontSize=Enum.FontSize.Size14
  192. status.BackgroundColor=BrickColor.new("Really black")
  193. status.TextColor=BrickColor.new("Institutional white")
  194. status.BorderSizePixel=0
  195.  
  196. local shot=false
  197. event=s.Selected:connect(function(m)
  198. local ccf
  199. local target
  200. local ftarg
  201. local hadtarget=false
  202. local unaim=false
  203. s.Parent=nil
  204. img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
  205. img1.Visible=true
  206. local aim=function()
  207. if not shot then
  208. target=nil
  209. local r=m.UnitRay
  210. local len=math.huge
  211. for _,o in next,workspace:GetChildren() do
  212. local fh=false
  213. for _,hum in next,o:GetChildren() do
  214. if hum.ClassName=="Humanoid" then
  215. fh=true
  216. break
  217. end
  218. end
  219. if o~=pc and fh then
  220. local h=o:findFirstChild("Head") or o:findFirstChild("Torso")
  221. if h and h.ClassName=="Part" then
  222. local cp=r:ClosestPoint(h.Position)
  223. local d=(h.Position-cp).magnitude/(cp-r.Origin).magnitude
  224. if d<=0.125 and d<=len then
  225. target=h
  226. len=d
  227. end
  228. end
  229. end
  230. end
  231. if target then
  232. local pos=tor.CFrame:pointToObjectSpace(target.Position)
  233. j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
  234. if target~=hadtarget then
  235. --print("Target acquired: ",target)
  236. hadtarget=target
  237. img1.Visible=false
  238. ch.Adornee=target
  239. ch.Enabled=true
  240. end
  241. status.Text="["..math.floor(pos.magnitude).."]"
  242. elseif not target then
  243. local pos=tor.CFrame:pointToObjectSpace((m.hit or tor.CFrame*CFrame.new(1.5,0.5,1)).p)
  244. j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
  245. img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
  246. if hadtarget then
  247. --print("Target lost")
  248. hadtarget=false
  249. ch.Enabled=false
  250. ch.Adornee=nil
  251. img1.Visible=true
  252. end
  253. status.Text=math.floor(pos.magnitude)
  254. end
  255. end
  256. end
  257.  
  258. local ev1=m.Move:connect(function() unaim=aim() end)--move arm and check for nearby targets
  259. local ev2=m.Button1Down:connect(function()--shoot at target
  260. unaim=aim()--returns nothing, but makes the continuous aim skip so it doesn't use up CPU for nothing
  261. ccf=tor.CFrame*j.C0*(j.C1:inverse())
  262. ftarg=target
  263. shot=true
  264. end)
  265.  
  266. repeat
  267. local ora=ra
  268. repeat--continuous aim
  269. if unaim then
  270. aim()
  271. else
  272. unaim=true
  273. end
  274. wait()
  275. until shot
  276. j:Destroy()
  277. local cccf=ccf
  278. local ltarg=ftarg
  279. local explode=false
  280. local v=Instance.new("BodyVelocity",ora)
  281. local b=Instance.new("BodyGyro",ora)
  282. b.maxTorque=Vector3.new(1e7,1e7,1e7)
  283. local function point(vel,cf)
  284. local x,y,z,xx,yx,zx,xy,yy,zy,xz,yz,zz=cf:components()
  285. v.velocity=-Vector3.new(yx,yy,yz)*vel
  286. b.cframe=cf
  287. end
  288. local v=0
  289. coroutine.resume(coroutine.create(function()
  290. local last=ora.Position
  291. repeat
  292. v=v+0.2
  293. if ltarg then
  294. 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()
  295. point(v,CFrame.new(0,0,0, xx,zx,-yx, 0,zy,yy, xz,zz,-yz))
  296. else
  297. point(v,cccf)
  298. end
  299. last=ora.Position
  300. wait()
  301. until explode or not (ora and ora.Parent==workspace)
  302. local exp=Instance.new("Explosion",workspace)
  303. exp.Position=last
  304. exp.BlastRadius=v/6
  305. if ltarg then
  306. for _,ff in next,ltarg.Parent:GetChildren() do
  307. local fie=ff.ClassName=="ForceField" and ff or ff:findFirstChild("ForceField")
  308. if fie then
  309. fie:Destroy()
  310. end
  311. end
  312. end
  313. end))
  314. ora.Name = "Vroom Vroom going to hit yo face!"
  315. coroutine.resume(coroutine.create(function()
  316. local f=Instance.new("Fire",ora)
  317. f.Name="Fiar"
  318. f.Size=0.49
  319. wait(1)
  320. ora.Touched:connect(function(h)
  321. 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
  322. explode=true
  323. ora:Destroy()
  324. end
  325. end)
  326. end))
  327. ora.Parent=workspace
  328. ra=rac:Clone()
  329. ra.Parent=pc
  330. j=Instance.new("Weld",tor)
  331. j.Name="Aim"
  332. j.Part0=tor
  333. j.Part1=ra
  334. j.C0=CFrame.new(1.5,0.5,0)
  335. j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
  336. shot=false
  337. until not (pc and pc.Parent==workspace or not (p and p.Parent==game.Players)) and not (ra and ra:IsDescendantOf(workspace))
  338. ev1:disconnect()
  339. ev2:disconnect()
  340. end)
  341. end
  342.  
  343. if p.Character then
  344. run(p.Character)
  345. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement