Advertisement
rubikz

Untitled

Aug 2nd, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.56 KB | None | 0 0
  1. Me = game.Players.RubikzCube
  2. Char = Me.Character
  3. Name = "xSGrapple"
  4. ToolName = "Grapple"
  5. Hold = false
  6. ButtonDown = false
  7. NeckO = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  8.  
  9.  
  10. function Prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form)
  11. part.Parent = parent
  12. part.formFactor = form
  13. part.CanCollide = collide
  14. part.Transparency = tran
  15. part.Reflectance = ref
  16. part.Size = Vector3.new(x,y,z)
  17. part.BrickColor = BrickColor.new(color)
  18. part.TopSurface = 0
  19. part.BottomSurface = 0
  20. part.Anchored = anchor
  21. part.Locked = true
  22. part:BreakJoints()
  23. end
  24.  
  25. function Weld(w, p, p1, a, b, c, x, y, z)
  26. w.Parent = p
  27. w.Part0 = p
  28. w.Part1 = p1
  29. w.C1 = CFrame.fromEulerAnglesXYZ(a,b,c) * CFrame.new(x,y,z)
  30. end
  31.  
  32. function GetCF(pos1, pos2)
  33. local pos4 = Vector3.new(pos2.X, pos1.Y, pos2.Z)
  34. return CFrame.new(pos1, pos4)
  35. end
  36.  
  37. function SetWeld(rw, R0, TO, mouse)
  38. local offset = (TO.Position.Y - mouse.Hit.p.Y)/60
  39. local mag = (TO.Position - mouse.Hit.p).magnitude/80
  40. offset = offset/mag
  41.  
  42. TO.Neck.C0 = NeckO * CFrame.Angles(offset, 0, 0)
  43.  
  44. rw.C0 = R0 * CFrame.Angles(-offset, 0, 0)
  45. end
  46.  
  47. Rarm = Char:findFirstChild("Right Arm")
  48. Larm = Char:findFirstChild("Left Arm")
  49. Torso = Char:findFirstChild("Torso")
  50. Hum = Char:findFirstChild("Humanoid")
  51.  
  52. BG = Instance.new("BodyGyro")
  53. BG.P = 10000
  54. BG.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  55.  
  56. for i,v in pairs(Char:children()) do
  57. if v.Name == Name then v:remove() end
  58. end
  59.  
  60. Mod = Instance.new("Model")
  61. Mod.Name = Name
  62.  
  63. Trail = Instance.new("Part")
  64. Prop( Trail, nil, false, 0, 0, 0.3, 1, 0.3, "Reddish brown", false, "Custom" )
  65. TrailMesh = Instance.new("CylinderMesh",Trail)
  66.  
  67. Main = Instance.new("Part")
  68. Prop( Main, Mod, false, 0, 0, 0.6, 1.4, 0.6, "Dark green", false, "Custom" )
  69. Instance.new("SpecialMesh",Main).MeshType = "Sphere"
  70.  
  71. TorsoHold = Instance.new("Weld")
  72. Weld( TorsoHold, Torso, Main, math.pi*1.2, 0, 0, -1.1, 0.7, 0.3 )
  73.  
  74. Neck = Instance.new("Part")
  75. Prop( Neck, Mod, false, 0, 0.1, 0.4, 1, 0.4, "Medium grey", false, "Custom" )
  76. Instance.new("CylinderMesh",Neck)
  77.  
  78. NeckWeld = Instance.new("Weld")
  79. Weld( NeckWeld, Main, Neck, 0, 0, 0, 0, -0.8, 0 )
  80.  
  81. for i = -60, 180, 20 do
  82. local Hook = Instance.new("Part")
  83. Prop( Hook, Mod, false, 0, 0.1, 0.3, 0.3, 0.3, "Medium grey", false, "Custom" )
  84. Instance.new("CylinderMesh",Hook)
  85.  
  86. local HookW = Instance.new("Weld")
  87. HookW.C0 = CFrame.new(-0.1, 1, 0) * CFrame.Angles(math.rad(i) - math.pi/1.7,0,0)
  88. Weld( HookW, Neck, Hook, 0, 0, 0, 0, 0, -0.7 )
  89. end
  90.  
  91. Hb = Instance.new("Part")
  92. Prop( Hb, Mod, false, 1, 0, 0.1, 0.1, 0.1, "Bright red", false, "Custom" )
  93. Hbw = Instance.new("Weld")
  94. Weld( Hbw, Rarm, Hb, 0, 0, 0, 0, 1, 0)
  95.  
  96. HW = Instance.new("Weld")
  97. Weld( HW, Hb, nil, -math.pi/2 - 0.7, 0, 0, 0, 0, 0)
  98.  
  99. Rb = Instance.new("Part")
  100. Prop( Rb, Mod, false, 1, 0, 0.1, 0.1, 0.1, "Bright red", false, "Custom" )
  101. Rh = Instance.new("Weld")
  102. Weld( Rh, Torso, Rb, 0, 0, 0, -1.5, -0.5, 0)
  103.  
  104. Lb = Instance.new("Part")
  105. Prop( Lb, Mod, false, 1, 0, 0.1, 0.1, 0.1, "Bright red", false, "Custom" )
  106. Lh = Instance.new("Weld")
  107. Weld( Lh, Torso, Lb, 0, 0, 0, 1.5, -0.5, 0)
  108.  
  109. RW = Instance.new("Weld")
  110. Weld(RW,Rb,nil,0,0,0,0,0.5,0)
  111.  
  112. LW = Instance.new("Weld")
  113. Weld(LW,Lb,nil,0,0,0,0,0.5,0)
  114.  
  115. RightBattle = nil
  116. LeftBattle = nil
  117. WepBattle = nil
  118.  
  119. Mod.Parent = Char
  120.  
  121. if script.Parent.className ~= "HopperBin" then
  122. Hop = Instance.new("HopperBin")
  123. Hop.Name = ToolName
  124. Hop.Parent = Me.Backpack
  125. script.Parent = Hop
  126. end
  127.  
  128. bin = script.Parent
  129.  
  130. function HoldArm()
  131. RW.Part1 = Rarm
  132. LW.Part1 = Larm
  133. TorsoHold.Part1 = nil
  134. HW.Part1 = Main
  135. end
  136.  
  137. function HoldTorso()
  138. RW.Part1 = nil
  139. LW.Part1 = nil
  140. TorsoHold.Part1 = Main
  141. HW.Part1 = nil
  142. end
  143.  
  144. function Normalize()
  145. RW.C0 = RightBattle
  146. LW.C0 = LeftBattle
  147. HW.C0 = WepBattle
  148. Torso.Neck.C0 = NeckO
  149. end
  150.  
  151. function SelectMotion()
  152. HoldArm()
  153. for i = 0, 40, 5 do
  154. RW.C0 = CFrame.Angles(math.rad(i), 0, 0)
  155. HW.C0 = CFrame.Angles(math.rad(i*4), 0, 0)
  156. wait()
  157. end
  158. if RightBattle == nil then
  159. RightBattle = RW.C0
  160. WepBattle = HW.C0
  161. LeftBattle = LW.C0
  162. end
  163. Normalize()
  164. end
  165.  
  166. function DeselMotion()
  167. HoldTorso()
  168. end
  169.  
  170. function Throw(Mouse)
  171. Hold = true
  172. for i = 0, 120, 15 do
  173. RW.C0 = RightBattle * CFrame.Angles(math.rad(i), 0, 0)
  174. wait()
  175. end
  176. local co = RW.C0
  177. BG.Parent = Torso
  178. Mouse.Button1Up:connect(function()
  179. Hold = false
  180. BG.Parent = nil
  181. end)
  182. while Hold do
  183. BG.cframe = GetCF(Torso.Position, Mouse.Hit.p)
  184. SetWeld(RW, co, Torso, Mouse)
  185. wait()
  186. end
  187. local Wn = RW.C0
  188. for i = 0, -60, -20 do
  189. RW.C0 = Wn * CFrame.Angles(math.rad(i), 0, 0)
  190. wait()
  191. end
  192. Wn = RW.C0
  193. HW.Part1 = nil
  194. local BF = Instance.new("BodyForce",Main)
  195. BF.force = Vector3.new(0,70,0)
  196. local Mag = (Torso.Position - Mouse.Hit.p).magnitude
  197. if Mag > 100 then Mag = 100 end
  198. local Lol = CFrame.new(Torso.Position, Mouse.Hit.p) * CFrame.Angles(math.pi/8,0,0) * CFrame.new(0,0,-Mag/3)
  199. Main.CanCollide = true
  200. local BP = Instance.new("BodyPosition",Main)
  201. BP.position = Lol.p
  202. BP.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  203. BP.P = 7000
  204. wait()
  205. BP:remove()
  206. Trail.Parent = Mod
  207. local touched = nil
  208. Main.Touched:connect(function(h)
  209. if h.CanCollide and h:GetMass() > 30 and touched == nil then
  210. touched = h
  211. end
  212. end)
  213. repeat
  214. local ma = (Torso.Position - Main.Position).magnitude
  215. TrailMesh.Scale = Vector3.new(1,ma,1)
  216. Trail.CFrame = CFrame.new(Torso.Position, Main.Position) * CFrame.Angles(math.pi/2,0,0) * CFrame.new(0,-ma/2,0)
  217. wait()
  218. until touched ~= nil
  219. local bpz = Instance.new("BodyPosition",Main)
  220. bpz.P = 15000
  221. bpz.position = Main.Position
  222. bpz.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  223. local bgz = Instance.new("BodyGyro",Main)
  224. bgz.P = 5000
  225. bgz.cframe = CFrame.new(Main.Position, Main.CFrame * CFrame.new(0,0,-2).p)
  226. bgz.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  227. for i = 0, 60, 10 do
  228. RW.C0 = Wn * CFrame.Angles(math.rad(-i), 0, math.rad(-i/1.5)) * CFrame.new(0,math.rad(-i/1.5),0)
  229. LW.C0 = LeftBattle * CFrame.Angles(math.rad(i*1.2), 0, math.rad(i/1.5)) * CFrame.new(0,math.rad(-i),0)
  230. wait()
  231. end
  232. local bpp = Instance.new("BodyPosition",Torso)
  233. bpp.P = 11000
  234. bpp.position = Main.Position
  235. bpp.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  236. repeat wait() until (Torso.Position - Main.Position).magnitude < 15
  237. bpz:remove()
  238. bgz:remove()
  239. bpp:remove()
  240. Normalize()
  241. Trail.Parent = nil
  242. end
  243.  
  244. function Select(mouse)
  245. SelectMotion()
  246. mouse.Button1Down:connect(function() Throw(mouse) end)
  247. end
  248.  
  249. function Desel()
  250. DeselMotion()
  251. end
  252.  
  253. bin.Selected:connect(Select)
  254. bin.Deselected:connect(Desel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement