Advertisement
astronaut32

madiik spear

Nov 5th, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.00 KB | None | 0 0
  1. local plr = game:service'Players'.LocalPlayer
  2. local char = plr.Character
  3. local mouse = plr:GetMouse()
  4. local humanoid = char:findFirstChild("Humanoid")
  5. local torso = char:findFirstChild("Torso")
  6. local head = char.Head
  7. local ra = char:findFirstChild("Right Arm")
  8. local la = char:findFirstChild("Left Arm")
  9. local rl = char:findFirstChild("Right Leg")
  10. local ll = char:findFirstChild("Left Leg")
  11. local rs = torso:findFirstChild("Right Shoulder")
  12. local ls = torso:findFirstChild("Left Shoulder")
  13. local rh = torso:findFirstChild("Right Hip")
  14. local lh = torso:findFirstChild("Left Hip")
  15. local neck = torso:findFirstChild("Neck")
  16. local cam = workspace.CurrentCamera
  17.  
  18.  
  19.  
  20. OVERPowered = false
  21.  
  22. local spear = Instance.new("Model", char)
  23. spear.Name = "Spear"
  24.  
  25. local BG = Instance.new("BodyGyro")
  26. BG.maxTorque = Vector3.new(0, 20e+763, 0)
  27. BG.P = 20e+003
  28. BG.D = 100
  29.  
  30. local handle = Instance.new("Part", spear)
  31. handle.Material = "SmoothPlastic"
  32. handle.formFactor = "Custom"
  33. handle.Size = Vector3.new(0.2, 0.2, 4)
  34. handle.BrickColor = BrickColor.new("Brown")
  35. handle:BreakJoints()
  36. Instance.new("SpecialMesh", handle).MeshId = "http://www.roblox.com/asset/?id=43645078"
  37. handle.Mesh.Scale = Vector3.new(1.5, 1.5, 1.5)
  38.  
  39. local weld = Instance.new("Weld", handle)
  40. weld.C0 = CFrame.new(0, 0.95, 0) * CFrame.Angles(0, 0, 0)
  41. weld.Part0 = handle
  42. weld.Part1 = ra
  43.  
  44.  
  45. function animate()
  46. BGcframestored = mouse.Hit
  47. BG.Parent = torso
  48. coroutine.wrap(function()
  49. for i = 0, 70, 10 do
  50. neck.C0 = neck.C0 * CFrame.Angles(0, 0, math.rad(10))
  51. BG.cframe = BGcframestored * CFrame.Angles(0, -math.rad(i), 0)
  52. wait()
  53. end
  54. end)()
  55. rs.Parent = nil
  56. local ar = Instance.new("Part", spear)
  57. ar.FormFactor = "Custom"
  58. ar.Size = Vector3.new(1, 1, 1)
  59. ar.Transparency = 1
  60. ar.CanCollide = false
  61. ar.Locked = true
  62. ar:BreakJoints()
  63. local weld = Instance.new("Weld", ar)
  64. weld.C0 = CFrame.new(0, 0.5, 0)
  65. weld.Part0 = ra
  66. weld.Part1 = ar
  67. local motor = Instance.new("Motor", spear)
  68. motor.Part0 = torso
  69. motor.Part1 = ar
  70. motor.C0 = CFrame.new(1.5, 0.5, 0)
  71. for angle = 0, 180, 20 do
  72. motor.C0 = CFrame.new(1.5,0.5,0) * CFrame.Angles(math.rad(angle), -math.rad(60), 0)
  73. game:service'RunService'.Stepped:wait()
  74. end
  75.  
  76.  
  77.  
  78.  
  79. coroutine.wrap(function()
  80. for angle = 180, 0, -20 do
  81. motor.C0 = CFrame.new(1.5,0.5,0) * CFrame.Angles(math.rad(angle), -math.rad(angle/3), 0)
  82. game:service'RunService'.Stepped:wait()
  83. end
  84. end)()
  85. coroutine.wrap(function()
  86. wait(0.1)
  87. for i = 70, 0, -10 do
  88. neck.C0 = neck.C0 * CFrame.Angles(0, 0, -math.rad(10))
  89. BG.cframe = BGcframestored * CFrame.Angles(0, -math.rad(i), 0)
  90. wait()
  91. end
  92. wait(0.4)
  93. motor:Destroy()
  94. BG.Parent = nil
  95. rs.Parent = torso
  96. ar:Destroy()
  97. end)()
  98. end
  99.  
  100. --billboardGui func
  101.  
  102. function billboardGui(msg, objvar)
  103.  
  104. coroutine.wrap(function()
  105. local prt = Instance.new("Part", char)
  106. prt.FormFactor = "Custom"
  107. prt.Size = Vector3.new(0.1, 0.1, 0.1)
  108. prt.Transparency = 1
  109. prt.CanCollide = false
  110. prt.CFrame = CFrame.new(objvar.CFrame.x, objvar.CFrame.y, objvar.CFrame.z)
  111. prt.Anchored = true
  112.  
  113. local bg = Instance.new("BillboardGui")
  114. bg.Parent = prt
  115. bg.Adornee = prt
  116. bg.Size = UDim2.new(4, 0, 3.5, 0)
  117. bg.ExtentsOffset = Vector3.new(0, 0, 0)
  118. local lol = Instance.new("TextLabel")
  119. lol.Size = UDim2.new(1.3, 0, 0.4, 0)
  120. lol.TextScaled = true
  121. lol.TextWrapped = true
  122. lol.BackgroundTransparency = 1
  123. lol.Parent = bg
  124. lol.FontSize = "Size24"
  125. lol.TextColor3 = Color3.new(1, 0, 0)
  126. lol.TextStrokeTransparency = 0
  127. lol.Font = "ArialBold"
  128. lol.Text = (msg)
  129.  
  130. for _ = 2, 15, 1 do
  131. if prt == nil then return end
  132. prt.CFrame = prt.CFrame * CFrame.new(0, 0.2, 0)
  133. game:service'RunService'.Stepped:wait()
  134. end
  135. for _ = 0, 10 do
  136. lol.TextStrokeTransparency = lol.TextStrokeTransparency + 0.1
  137. lol.TextTransparency = lol.TextTransparency + 0.1
  138. wait()
  139. end
  140.  
  141. prt:Destroy()
  142. end)()
  143. end
  144.  
  145. --ray func
  146.  
  147. function rayCast(speed, gravity)
  148. coroutine.wrap(function()
  149.  
  150.  
  151.  
  152. local rayPart = Instance.new("Part")
  153.  
  154. rayPart.Name = "RayPart"
  155.  
  156. rayPart.BrickColor = BrickColor.new("Brown")
  157.  
  158. rayPart.Anchored = true
  159. rayPart.CanCollide = false
  160. rayPart.Locked = true
  161.  
  162. rayPart.TopSurface = Enum.SurfaceType.Smooth
  163. rayPart.BottomSurface = Enum.SurfaceType.Smooth
  164. rayPart.formFactor = Enum.FormFactor.Custom
  165. rayPart.Size = Vector3.new(0.2, 0.2, 3)
  166. Instance.new("SpecialMesh", rayPart).MeshId = "http://www.roblox.com/asset/?id=43645078"
  167. rayPart.Mesh.Scale = Vector3.new(1.5, 1.5, 1.5)
  168.  
  169.  
  170.  
  171.  
  172.  
  173. local bulletposition = handle.Position + Vector3.new(0, 0, 0)
  174.  
  175. local bulletvelocity = (Vector3.new(math.random(-2,2), math.random(-1,1), math.random(-2,2)))+( plr:GetMouse().Hit.p - bulletposition).unit*speed
  176. local bulletlastposition = bulletposition
  177.  
  178.  
  179.  
  180.  
  181.  
  182. coroutine.resume(coroutine.create(function()
  183. while true do
  184. local dt = wait()
  185. bulletlastposition = bulletposition
  186. bulletvelocity = bulletvelocity + (Vector3.new(0, -9.81*gravity, 0)*dt)
  187. bulletposition = bulletposition + (bulletvelocity*dt)
  188.  
  189. local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition))
  190.  
  191. local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayPart} )
  192.  
  193. if (torso.Position - rayPart.Position).magnitude > 540 then
  194. rayPart:Destroy()
  195. break
  196. end
  197.  
  198.  
  199. if hit then
  200. local damage = math.random(24, 32)
  201. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  202. if OVERPowered then
  203. hit.Parent:BreakJoints()
  204. else
  205. hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
  206. billboardGui("-"..damage, rayPart)
  207. end
  208.  
  209. end
  210.  
  211. if hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then
  212. if OVERPowered then
  213. hit.Parent.Parent:BreakJoints()
  214. else
  215. hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage
  216. billboardGui("-"..damage, rayPart)
  217. end
  218.  
  219.  
  220. if hit.Name == "Tire" and hit ~= nil then
  221. hit:BreakJoints()
  222. end
  223.  
  224. end
  225. bulletposition = hitposition
  226. if hit.Name == "RayPart" then
  227. hit:Destroy()
  228. rayPart:Destroy()
  229. else
  230. wait(5)
  231. rayPart:Destroy()
  232. end
  233. break
  234. end
  235. rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(-math.pi, 0, 0)
  236. rayPart.Parent = workspace
  237. end
  238. end))
  239. end)()
  240. end
  241.  
  242. mouse.Button1Down:connect(function(mouse)
  243. if char.Humanoid.Health == 0 then
  244. return end
  245. if debounce then return end
  246. debounce = true
  247. animate()
  248. rayCast(100, 7)
  249. wait(0.8)
  250. debounce = false
  251. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement