Advertisement
Kittdy2

Untitled

Jan 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.95 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87.  
  88.  
  89. --Limb Launcher by xXxMoNkEyMaNxXx V5.0
  90. script.Parent=nil
  91. local next=next
  92. local crosshairimg="http://www.roblox.com/asset?id=20457765"
  93. game:service("ContentProvider"):Preload(crosshairimg)
  94. local ready=false
  95.  
  96. local event
  97. local p=owner
  98. function run(pc)
  99. if event then event:disconnect() end
  100. wait(0.25)
  101. local tor=pc and pc:findFirstChild("Torso")
  102. local rs=tor and tor:findFirstChild("Right Shoulder")
  103. local ra=pc and pc:findFirstChild("Right Arm")
  104. local f=Instance.new("Fire",ra)
  105. f.Size=0.5
  106. local rac=ra:Clone()
  107. f:Destroy()
  108. if rs then
  109. rs:Destroy()
  110. end
  111. local j=Instance.new("Weld",tor)
  112. j.Name="Aim"
  113. j.Part0=tor
  114. j.Part1=ra
  115. j.C0=CFrame.new(1.5,0.5,0)
  116. j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
  117. local s=Instance.new("HopperBin",p.Backpack)
  118. s.Name="Limb Launcher"
  119. local g=Instance.new("ScreenGui",p.PlayerGui)
  120. g.Name="Crosshair no target"
  121. local img1=Instance.new("ImageLabel",g)
  122. img1.Name="IMG"
  123. img1.Size=UDim2.new(0,210,0,210)
  124. img1.Position=UDim2.new(0,0,0,0)
  125. img1.BackgroundTransparency=1
  126. img1.Visible=false
  127. img1.Image=crosshairimg
  128. local ch=Instance.new("BillboardGui",p.PlayerGui)
  129. ch.Name="Crosshair on target"
  130. ch.Size=UDim2.new(0,210,0,210)
  131. ch.AlwaysOnTop=true
  132. ch.Enabled=false
  133. local img2=Instance.new("ImageLabel",ch)
  134. img2.Name="IMG"
  135. img2.Size=UDim2.new(1,0,1,0)
  136. img2.BackgroundTransparency=1
  137. img2.Image=crosshairimg
  138.  
  139. local shot=false
  140. event=s.Selected:connect(function(m)
  141. local ccf
  142. local target
  143. local ftarg
  144. local hadtarget=false
  145. local unaim=false
  146. s.Parent=nil
  147. img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
  148. img1.Visible=true
  149. local aim=function()
  150. if not shot then
  151. target=nil
  152. local r=m.UnitRay
  153. local len=math.huge
  154. for _,o in next,workspace:GetChildren() do
  155. local fh=false
  156. for _,hum in next,o:GetChildren() do
  157. if hum.ClassName=="Humanoid" then
  158. fh=true
  159. break
  160. end
  161. end
  162. if o~=pc and fh then
  163. local h=o:findFirstChild("Head") or o:findFirstChild("Torso")
  164. if h and h.ClassName=="Part" then
  165. local cp=r:ClosestPoint(h.Position)
  166. local d=(h.Position-cp).magnitude/(cp-r.Origin).magnitude
  167. if d<=0.125 and d<=len then
  168. target=h
  169. len=d
  170. end
  171. end
  172. end
  173. end
  174. if target then
  175. local pos=tor.CFrame:pointToObjectSpace(target.Position)
  176. j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
  177. if target~=hadtarget then
  178. --print("Target acquired: ",target)
  179. hadtarget=target
  180. img1.Visible=false
  181. ch.Adornee=target
  182. ch.Enabled=true
  183. end
  184. elseif not target then
  185. local pos=tor.CFrame:pointToObjectSpace((m.hit or tor.CFrame*CFrame.new(1.5,0.5,1)).p)
  186. j.C0=CFrame.new(Vector3.new(1.5,0.5,0),pos)
  187. img1.Position=UDim2.new(0,m.X-105,0,m.Y-105)
  188. if hadtarget then
  189. --print("Target lost")
  190. hadtarget=false
  191. ch.Enabled=false
  192. ch.Adornee=nil
  193. img1.Visible=true
  194. end
  195. end
  196. end
  197. end
  198.  
  199. local ev1=m.Move:connect(function() unaim=aim() end)--move arm and check for nearby targets
  200. local ev2=m.Button1Down:connect(function()--shoot at target
  201. unaim=aim()--returns nothing, but makes the continuous aim skip so it doesn't use up CPU for nothing
  202. ccf=tor.CFrame*j.C0*(j.C1:inverse())
  203. ftarg=target
  204. shot=true
  205. end)
  206.  
  207. repeat
  208. local ora=ra
  209. repeat--continuous aim
  210. if unaim then
  211. aim()
  212. else
  213. unaim=true
  214. end
  215. wait()
  216. until shot
  217. j:Destroy()
  218. local cccf=ccf
  219. local ltarg=ftarg
  220. local explode=false
  221. local v=Instance.new("BodyVelocity",ora)
  222. local b=Instance.new("BodyGyro",ora)
  223. b.maxTorque=Vector3.new(1e7,1e7,1e7)
  224. local function point(vel,cf)
  225. local x,y,z,xx,yx,zx,xy,yy,zy,xz,yz,zz=cf:components()
  226. v.velocity=-Vector3.new(yx,yy,yz)*vel
  227. b.cframe=cf
  228. end
  229. local v=0
  230. coroutine.resume(coroutine.create(function()
  231. local last=ora.Position
  232. repeat
  233. v=v+0.2
  234. if ltarg then
  235. 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()
  236. point(v,CFrame.new(0,0,0, xx,zx,-yx, 0,zy,yy, xz,zz,-yz))
  237. else
  238. point(v,cccf)
  239. end
  240. last=ora.Position
  241. wait()
  242. until explode or not (ora and ora.Parent==workspace)
  243. local exp=Instance.new("Explosion",workspace)
  244. exp.Position=last
  245. exp.BlastRadius=v/6
  246. if ltarg then
  247. for _,ff in next,ltarg.Parent:GetChildren() do
  248. local fie=ff.ClassName=="ForceField" and ff or ff:findFirstChild("ForceField")
  249. if fie then
  250. fie:Destroy()
  251. end
  252. end
  253. end
  254. end))
  255. coroutine.resume(coroutine.create(function()
  256. wait(1)
  257. ora.Touched:connect(function(h)
  258. if (h==ltarg or not (ltarg and workspace:IsAncestorOf(ltarg))) and not (pc and pc.Parent==workspace and h:IsDescendantOf(pc)) then
  259. explode=true
  260. ora:Destroy()
  261. end
  262. end)
  263. end))
  264. ora.Parent=workspace
  265. ra=rac:Clone()
  266. ra.Parent=pc
  267. j=Instance.new("Weld",tor)
  268. j.Name="Aim"
  269. j.Part0=tor
  270. j.Part1=ra
  271. j.C0=CFrame.new(1.5,0.5,0)
  272. j.C1=CFrame.new(0,0.5,0, 1,0,0, 0,0,1, 0,-1,0)
  273. shot=false
  274. until not (pc and pc.Parent==workspace or not (p and p.Parent==game.Players)) and not (ra and ra:IsDescendantOf(workspace))
  275. ev1:disconnect()
  276. ev2:disconnect()
  277. --[[
  278. if not (p and p.Parent==game.Players) then
  279. repeat
  280. if ready then
  281. --same thing
  282. end
  283. wait()
  284. until
  285. end
  286. --]]
  287. end)
  288. end
  289. p.CharacterAdded:connect(function(char)
  290. if p and p.Parent==game.Players then
  291. run(char)
  292. else
  293. --insert joint
  294. end
  295. end)
  296. if p.Character then
  297. run(p.Character)
  298. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement