kakeru012435

EHHHHHHHHHHH!

Jul 20th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.95 KB | None | 0 0
  1. --Made by N3xul
  2. local runDummyScript = function(f,scri)
  3. local oldenv = getfenv(f)
  4. local newenv = setmetatable({}, {
  5. __index = function(_, k)
  6. if k:lower() == 'script' then
  7. return scri
  8. else
  9. return oldenv[k]
  10. end
  11. end
  12. })
  13. setfenv(f, newenv)
  14. ypcall(function() f() end)
  15. end
  16. cors = {}
  17. mas = Instance.new("Model",game:GetService("Lighting"))
  18. mas.Name = "CompiledModel"
  19. o1 = Instance.new("Tool")
  20. o2 = Instance.new("Part")
  21. o3 = Instance.new("Sound")
  22. o4 = Instance.new("Sound")
  23. o5 = Instance.new("SpecialMesh")
  24. o6 = Instance.new("Sound")
  25. o9 = Instance.new("SpecialMesh")
  26. o10 = Instance.new("LocalScript")
  27. o1.Name = "ImprovedGrappleHook"
  28. o1.Parent = mas
  29. o1.TextureId = "http://www.roblox.com/asset/?id=89992557"
  30. o1.GripPos = Vector3.new(0, -0.0900000036, 1.10000002)
  31. o2.Name = "Handle"
  32. o2.Parent = o1
  33. o2.BrickColor = BrickColor.new("Black")
  34. o2.Position = Vector3.new(44.3999977, 0.500012994, 148)
  35. o2.FormFactor = Enum.FormFactor.Custom
  36. o2.Size = Vector3.new(0.800000012, 1, 2.29999995)
  37. o2.CFrame = CFrame.new(44.3999977, 0.500012994, 148, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  38. o2.BottomSurface = Enum.SurfaceType.Smooth
  39. o2.TopSurface = Enum.SurfaceType.Smooth
  40. o2.Color = Color3.new(0.105882, 0.164706, 0.207843)
  41. o2.Position = Vector3.new(44.3999977, 0.500012994, 148)
  42. o3.Name = "ConnectSound"
  43. o3.Parent = o2
  44. o3.SoundId = "http://www.roblox.com/asset/?id=13510737"
  45. o3.Volume = 1
  46. o4.Name = "FireSound"
  47. o4.Parent = o2
  48. o4.SoundId = "http://www.roblox.com/asset/?id=16211041"
  49. o4.Volume = 1
  50. o5.Parent = o2
  51. o5.MeshId = "http://www.roblox.com/asset/?id=89987774"
  52. o5.TextureId = "http://www.roblox.com/asset/?id=89987914"
  53. o5.MeshType = Enum.MeshType.FileMesh
  54. o6.Name = "HitSound"
  55. o6.Parent = o2
  56. o6.SoundId = "http://www.roblox.com/asset/?id=16211030"
  57. o6.Volume = 1
  58. o9.Parent = o1
  59. o9.Scale = Vector3.new(0.5, 1, 0.5)
  60. o10.Name = "grappleScript"
  61. o10.Parent = o1
  62. table.insert(cors,coroutine.create(function()
  63. wait()
  64. runDummyScript(function()
  65. --Edited by QS
  66.  
  67. local maxDistance = 300
  68. local canFireWhileGrappling = false
  69.  
  70.  
  71. local Tool = script.Parent;
  72. local torso = nil
  73. local human = nil
  74. local bolt = nil
  75. local targetPos = Vector3.new(0,0,0)
  76. local boltconnect = nil
  77. local holdweld = nil
  78.  
  79. local defaultPos = Vector3.new(0,-.09,1.1)
  80. local adjustedPos = Vector3.new(0,0,.605)
  81.  
  82. local rope = Instance.new("Part")
  83. --rope.BrickColor = BrickColor.new("Black")
  84. rope.TopSurface = 0
  85. rope.BottomSurface = 0
  86. rope.formFactor = "Symmetric"
  87. rope.Name = "Rope"
  88. rope.CanCollide = false
  89. rope.Anchored = true
  90. local mesh = Instance.new("CylinderMesh")
  91. mesh.Parent = rope
  92. mesh.Scale = Vector3.new(0.1,1,0.1)
  93.  
  94. local RetractionSpeed = 45
  95. local StartDistance = 100
  96.  
  97. local PlayerBodyVelocity = Instance.new("BodyVelocity")
  98. PlayerBodyVelocity.maxForce = Vector3.new(1e+006, 1e+006, 1e+006)
  99. local ObjectBodyVelocity = Instance.new("BodyVelocity")
  100. ObjectBodyVelocity.maxForce = Vector3.new(5000,5000,5000) --force necessary to forcefully grab a player
  101.  
  102. local bodyPos = Instance.new("BodyPosition")
  103. bodyPos.D = 1e+003
  104. bodyPos.P = 3e+003
  105. bodyPos.maxForce = Vector3.new(1e+006, 1e+006, 1e+006)
  106.  
  107. local bodyGyro = Instance.new("BodyGyro")
  108. bodyGyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  109.  
  110. function BreakRope()
  111. if human then
  112. human.Sit = false
  113. end
  114. rope.Parent = nil
  115. if PlayerBodyVelocity then PlayerBodyVelocity.Parent = nil end
  116. if ObjectBodyVelocity then ObjectBodyVelocity.Parent = nil end
  117. bodyGyro.Parent = nil
  118. if bolt ~= nil then
  119. bolt.Parent = nil
  120. end
  121. if holdweld ~= nil then
  122. holdweld.Parent = nil
  123. end
  124. holdweld = nil
  125. bolt = nil
  126. Tool.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=89987774"
  127. Tool.GripPos = defaultPos
  128.  
  129. wait(.45)
  130. if bolt == nil then
  131. bodyGyro.Parent = nil --keep the gyro a little longer so retracted object doesnt ragdoll player
  132. end
  133. --script.Parent.Bolt.Transparency = 0
  134. end
  135.  
  136. function adjustRope()
  137. if bolt and torso then
  138. if (torso.Position - bolt.Position).magnitude > maxDistance then BreakRope() end
  139. end
  140. if rope.Parent == nil or bolt == nil then return end
  141. local pos1 = Tool.Handle.Position + Tool.Handle.CFrame.lookVector*.7
  142. local pos2 = bolt.Position
  143. rope.Size = Vector3.new(0, 1, 0)
  144. rope.Mesh.Scale = Vector3.new(0.1, (pos1-pos2).magnitude, 0.1)
  145. rope.CFrame = CFrame.new((pos1 + pos2)/2, pos2) * CFrame.fromEulerAnglesXYZ(-math.pi/2,0,0)
  146. end
  147.  
  148. function updateVelocities()
  149. if bolt and torso and ObjectBodyVelocity then
  150. local grappleVector = (torso.Position - bolt.Position)
  151. if grappleVector.magnitude > maxDistance then
  152. BreakRope()
  153. return
  154. end
  155. if bolt.Velocity.magnitude < 3 and -1* torso.Velocity:Dot(grappleVector.unit) < 5 and grappleVector.magnitude < .75 * StartDistance then
  156. print("hop up")
  157. PlayerBodyVelocity.velocity = PlayerBodyVelocity.velocity + Vector3.new(0,20,0)
  158. wait(.25)
  159. BreakRope()
  160. return
  161. end
  162. if grappleVector.magnitude < 3.5 then
  163. print("grapple end")
  164. wait(.20)
  165. BreakRope()
  166. return
  167. else
  168. ObjectBodyVelocity.velocity = grappleVector.unit * RetractionSpeed
  169. local boltRetraction = math.max(grappleVector.unit:Dot(bolt.Velocity),0) --no negative speed
  170. local playerSpeed = math.max(0, RetractionSpeed - 5 - boltRetraction)
  171. if playerSpeed == 0 then
  172. PlayerBodyVelocity.Parent = nil
  173. else
  174. PlayerBodyVelocity.Parent = torso
  175. PlayerBodyVelocity.velocity = grappleVector.unit * playerSpeed * -1
  176. end
  177. end
  178. else
  179. BreakRope()
  180. end
  181. end
  182.  
  183. function onBoltHit(hit)
  184. if bolt == nil or hit == nil or hit.Parent == nil or hit == rope or bolt.Name ~= "Bolt" or hit.Parent == Tool or hit.Parent == Tool.Parent or hit.Parent.Parent == Tool.Parent or hit.Parent.Name == "Attached Bolt" then
  185. return
  186. end
  187. local grappleVector = (torso.Position - bolt.Position)
  188. StartDistance = grappleVector.magnitude
  189. if StartDistance > maxDistance then
  190. bolt.Parent = nil
  191. bolt = nil
  192. return
  193. end
  194.  
  195. bolt.Name = "Attached Bolt"
  196. local boltFrame = CFrame.new(hit.Position)
  197.  
  198. local C0 = hit.CFrame:inverse() * boltFrame
  199. local C1 = bolt.CFrame:inverse() * boltFrame
  200. local weld = Instance.new("Weld")
  201. weld.Part0 = hit
  202. weld.Part1 = bolt
  203. weld.C0 = C0
  204. weld.C1 = C1
  205. weld.Parent = bolt
  206.  
  207. local hum = hit.Parent:FindFirstChild("Humanoid")
  208. if hum then hum.Sit = true end
  209.  
  210. if bolt:FindFirstChild("HitSound") then bolt.HitSound:play() end
  211. local backupbolt = bolt
  212.  
  213.  
  214. ObjectBodyVelocity = Instance.new("BodyVelocity")
  215. ObjectBodyVelocity.maxForce = Vector3.new(5000,5000,5000)
  216. ObjectBodyVelocity.velocity = grappleVector.unit * RetractionSpeed
  217. ObjectBodyVelocity.Parent = bolt
  218.  
  219. wait(0.4)
  220. if bolt == nil or bolt ~= backupbolt then return end
  221. bolt.ConnectSound:play()
  222. Tool.Handle.ConnectSound:play()
  223.  
  224. targetPos = bolt.Position
  225. backupPos = bolt.Position
  226.  
  227. --bodyPos.position = targetPos
  228. --bodyPos.Parent = torso
  229. PlayerBodyVelocity.Parent = torso
  230. PlayerBodyVelocity.velocity = Vector3.new(0,0,0)
  231. bodyGyro.cframe = torso.CFrame
  232. bodyGyro.Parent = torso
  233.  
  234. while bolt ~= nil do
  235. --bodyPos.position = bolt.Position
  236. updateVelocities()
  237. wait(1/30)
  238. end
  239. end
  240.  
  241. enabled = true
  242. local canReset = true
  243.  
  244. function onButton1Down(mouse)
  245.  
  246. if bolt and canReset then
  247. BreakRope()
  248. end
  249. if not enabled then
  250. return
  251. end
  252.  
  253. if bolt ~= nil and not canFireWhileGrappling then return end
  254. if bolt ~= nil then
  255. if boltconnect ~= nil then
  256. print("Disconnecting")
  257. boltconnect:disconnect()
  258. end
  259. bolt:remove()
  260. targetPos = Vector3.new(0,0,0)
  261. end
  262.  
  263. Tool.Handle.FireSound:play()
  264.  
  265. enabled = false
  266.  
  267. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  268.  
  269. --bolt = game:GetService("InsertService"):LoadAsset(33393977)
  270.  
  271. bolt = Tool.Handle:Clone()
  272. bolt.Name = "Bolt"
  273. bolt.Size = Vector3.new(1,.4,1)
  274. bolt.Locked = false
  275. bolt.Mesh.MeshId = "http://www.roblox.com/asset/?id=89989174"
  276.  
  277. --local instances = bolt:GetChildren()
  278. --if #instances == 0 then
  279. -- bolt:Remove()
  280. -- return
  281. --end
  282.  
  283. --bolt = bolt:FindFirstChild("Bolt")
  284. --local boltMesh = bolt:FindFirstChild("Mesh")
  285.  
  286. bolt.CFrame = CFrame.new(Tool.Handle.Position + (mouse.Hit.p - Tool.Handle.Position).unit * 5,mouse.Hit.p) --* CFrame.fromEulerAnglesXYZ(0,math.pi,0)
  287. bolt.Transparency = 0
  288. bolt.CanCollide = false
  289. bolt.Velocity = bolt.CFrame.lookVector * 80
  290. if bolt:findFirstChild("BodyPosition") ~= nil then
  291. bolt.BodyPosition:remove()
  292. end
  293. local force = Instance.new("BodyForce")
  294. force.force = Vector3.new(0,bolt:GetMass() * 196.1,0)
  295. force.Parent = bolt
  296. bolt.Parent = workspace
  297. boltconnect = bolt.AncestryChanged:connect(function() onKeyDown("q") end)
  298. bolt.Touched:connect(onBoltHit)
  299.  
  300. rope.Parent = Tool
  301.  
  302. bolt.Parent = game.Workspace
  303.  
  304. Tool.Handle.Mesh.MeshId = "http://www.roblox.com/asset/?id=89988787"
  305. Tool.GripPos = adjustedPos
  306. canReset = false
  307. wait(.5)
  308. canReset = true
  309. wait(1)
  310.  
  311. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  312.  
  313. enabled = true
  314. end
  315.  
  316. function onKeyDown(key)
  317. key = key:lower()
  318. if key == "q" then
  319. BreakRope()
  320. end
  321. end
  322.  
  323. function getHumanoid(obj)
  324. for i,child in pairs(obj:getChildren()) do
  325. if child.className == "Humanoid" then
  326. return child
  327. end
  328. end
  329. end
  330.  
  331. function onEquippedLocal(mouse)
  332. if mouse == nil then
  333. print("Mouse not found")
  334. return
  335. end
  336.  
  337. torso = Tool.Parent:findFirstChild("Torso")
  338. human = Tool.Parent:FindFirstChild("Humanoid")--getHumanoid(Tool.Parent)
  339. if torso == nil or human == nil then return end
  340. human.Jumping:connect(function() onKeyDown("q") end)
  341.  
  342. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  343. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  344. mouse.KeyDown:connect(onKeyDown)
  345. end
  346.  
  347.  
  348. Tool.Equipped:connect(onEquippedLocal)
  349. Tool.Unequipped:connect(function() onKeyDown("q") end)
  350.  
  351. while true do
  352. adjustRope()
  353. wait(1/60)
  354. end
  355.  
  356. end,o10)
  357. end))
  358. mas.Parent = workspace
  359. mas:MakeJoints()
  360. local mas1 = mas:GetChildren()
  361. for i=1,#mas1 do
  362. mas1[i].Parent = game:GetService("Players").LocalPlayer.Backpack
  363. ypcall(function() mas1[i]:MakeJoints() end)
  364. end
  365. mas:Destroy()
  366. for i=1,#cors do
  367. coroutine.resume(cors[i])
  368. end
Add Comment
Please, Sign In to add comment