Advertisement
SmokeDelsin

attack

May 28th, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.15 KB | None | 0 0
  1. do --rayCast
  2. function rayCast(startpos, Speed, Gravity, Dmg, color)
  3. local ran,err = ypcall(function()
  4. local rayPart = Instance.new("Part")
  5. rayPart.Name = "RayPart"
  6. rayPart.BrickColor = BrickColor.new(color)
  7. rayPart.Anchored = true
  8. rayPart.CanCollide = false
  9. rayPart.Locked = true
  10. rayPart.FormFactor = "Custom"
  11. rayPart.TopSurface = Enum.SurfaceType.Smooth
  12. rayPart.BottomSurface = Enum.SurfaceType.Smooth
  13. rayPart.Size = Vector3.new(.2, 50, .2)
  14. rayPart:breakJoints()
  15. Instance.new("CylinderMesh", rayPart)
  16. local fire = Instance.new("Fire", rayPart)
  17. fire.Color = rayPart.BrickColor.Color
  18. fire.SecondaryColor = rayPart.BrickColor.Color
  19. fire.Heat = 0
  20. fire.Size = 10
  21. local pl = Instance.new("PointLight", rayPart)
  22. pl.Color = Color3.new(rayPart.BrickColor.r/1.5, rayPart.BrickColor.g/1.5, rayPart.BrickColor.b/1.5)
  23. pl.Range = 18
  24.  
  25. local hitobj = false
  26. local bulletposition = startpos.Position
  27. rayPart.CFrame = startpos.CFrame
  28. trailconnect(rayPart, hitobj)
  29.  
  30. local bulletvelocity = (Vector3.new(math.random(-2,2), math.random(-2,2), math.random(-2,2)))+( mouse.Hit.p - bulletposition).unit*Speed
  31. local bulletlastposition = bulletposition
  32.  
  33. coroutine.resume(coroutine.create(function()
  34. while true do
  35.  
  36. local dt = wait()
  37. bulletlastposition = bulletposition
  38. bulletvelocity = bulletvelocity + (Vector3.new(0, -3.81*Gravity, 0)*dt)
  39. bulletposition = bulletposition + (bulletvelocity*dt)
  40. local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition))
  41. local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, {char, modelforparts} )
  42.  
  43. if (torso.Position - rayPart.Position).magnitude > 840 then
  44. rayPart:Destroy()
  45. hitobj = true
  46. break
  47. end
  48.  
  49.  
  50. if hit then
  51. hitobj = true
  52. local damage = math.random(Dmg, Dmg+6)
  53. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  54. hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
  55. elseif hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") then
  56. hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage
  57. end
  58. local boom = Instance.new("Part", modelforparts)
  59. boom.BrickColor = rayPart.BrickColor
  60. boom.Anchored = true
  61. boom.FormFactor = "Custom"
  62. boom.Size = Vector3.new(1,1,1)
  63. boom.CanCollide = false
  64. boom.Transparency = 0.25
  65. boom.CFrame = CFrame.new(hitposition.x, hitposition.y, hitposition.z)
  66. boom.TopSurface = 0
  67. boom.BottomSurface = 0
  68. local sphere = Instance.new("SpecialMesh", boom)
  69. sphere.MeshType = "Sphere"
  70. local pl = Instance.new("PointLight", boom)
  71. pl.Color = Color3.new(boom.BrickColor.r/1.5, boom.BrickColor.g/1.5, boom.BrickColor.b/1.5)
  72. pl.Range = 20
  73. for ye = 0, 8 do
  74. local lite = Instance.new("Part", boom)
  75. lite.FormFactor = "Custom"
  76. lite.Size = Vector3.new(.2, 1.5, .2)
  77. lite.BrickColor = boom.BrickColor
  78. lite.CanCollide = false
  79. lite.TopSurface = 0
  80. lite.Anchored = false
  81. lite.BottomSurface = 0
  82. lite.Position = boom.Position + Vector3.new(math.random(-10, 10), math.random(6,15), math.random(-10, 10))
  83. end
  84.  
  85. for i = 0, 20, 2.5 do
  86. sphere.Scale = sphere.Scale + Vector3.new(i,i,i)
  87. boom.Transparency = boom.Transparency + i/60
  88. pl.Range = pl.Range + i/15
  89. wait()
  90. end
  91. boom:Destroy()
  92. for i,v in pairs(workspace:children()) do
  93. if v:IsA("Model") and v:findFirstChild("Humanoid") then
  94. if v:findFirstChild("Head") and v:findFirstChild("Torso") then
  95. if (v:findFirstChild("Torso").Position - boom.Position).magnitude < 16 and v.Name ~= char.Name then
  96. v:findFirstChild("Humanoid"):TakeDamage(math.random(Dmg+2,Dmg+6))
  97. end
  98. end
  99. end
  100. if v and v:IsA("Part") and v.Name ~= "Base" then
  101. if (v.Position - boom.Position).magnitude < 16 then
  102. v:BreakJoints()
  103. v.TopSurface = 0
  104. v.BottomSurface = 0
  105. v.LeftSurface = 0
  106. v.RightSurface = 0
  107. v.FrontSurface = 0
  108. v.BackSurface = 0
  109. v.Anchored = false
  110. end
  111. end
  112. end
  113. pcall(function()
  114. bulletposition = hitposition
  115. rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
  116. rayPart:Destroy()
  117. end)
  118. break
  119. end
  120. rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0)
  121. rayPart.Parent = modelforparts
  122. end
  123. end))
  124. for i = 70, 65, -1.5 do
  125. firing = true
  126. camera.FieldOfView = i
  127. wait()
  128. end
  129. for i = 65, 70, 2.5 do
  130. firing = false
  131. camera.FieldOfView = i
  132. wait()
  133. end
  134. end)
  135. if err then
  136. print(err)
  137. end
  138. end
  139. end
  140.  
  141.  
  142. charge = 100
  143.  
  144. plrgui = game:service'Players'.LocalPlayer:findFirstChild("PlayerGui")
  145.  
  146. local statusgui = Instance.new("ScreenGui", plrgui)
  147. local mainframe = Instance.new("Frame", statusgui)
  148. mainframe.Size = UDim2.new(0, 200, 0, 200)
  149. mainframe.Position = UDim2.new(.75, 0, .75, 0)
  150. mainframe.Style = 3
  151. local image = Instance.new("ImageLabel", mainframe)
  152. image.Size = UDim2.new(1, 0, .47, 0)
  153. image.Position = UDim2.new(0, 0, .235, 0)
  154. image.BackgroundTransparency = 1
  155. image.Image = "rbxassetid://145057975"
  156. local chargetext = Instance.new("TextLabel", mainframe)
  157. chargetext.FontSize = "Size18"
  158. chargetext.Size = UDim2.new(1, 0, .95, 0)
  159. chargetext.TextYAlignment = "Bottom"
  160. chargetext.BackgroundTransparency = 1
  161. chargetext.TextColor3 = Color3.new(1,1,1)
  162. game:service'RunService'.Stepped:connect(function()
  163. chargetext.Text = math.floor(charge).."%"
  164. end)
  165.  
  166.  
  167.  
  168. local rm = Instance.new("Weld", torso)
  169. rm.C0 = CFrame.new(1.5, 0.5, 0)
  170. rm.C1 = CFrame.new(0, 0.5, 0)
  171. rm.Part0 = torso
  172. rm.Part1 = ra
  173. local lm = Instance.new("Weld", torso)
  174. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  175. lm.C1 = CFrame.new(0, 0.5, 0)
  176. lm.Part0 = torso
  177. lm.Part1 = la
  178.  
  179. sound = Instance.new("Sound", head)
  180. sound.Volume = 1
  181. sound.SoundId = "rbxassetid://144834276"
  182. sound.Looped = true
  183.  
  184.  
  185. dancemode = true
  186. debounceofsprint = false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement