Advertisement
princeofheaven

Master Spark

Jun 7th, 2015
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. local Tool = script.Parent
  2. local spark = nil
  3. local numOfSparks = 100
  4.  
  5. enabled = true
  6.  
  7. function createSpark(v, pos, vCharacter)
  8.  
  9. local missile = Instance.new("Part")
  10.  
  11. local spark = Instance.new("Sparkles")
  12.  
  13. local SparkSound = Instance.new("Sound")
  14. SparkSound.Name = "SparkSound"
  15. SparkSound.SoundId = "http://www.roblox.com/asset/?id=10756104"
  16. SparkSound.Parent = missile
  17. SparkSound.Volume = 1
  18. SparkSound.Looped = true
  19.  
  20. spark.Parent = missile
  21.  
  22. missile.Position = pos
  23. missile.Size = Vector3.new(1,1,1)
  24. missile.Velocity = (pos - v).unit * 50
  25. missile.BrickColor = BrickColor.new(26)
  26. missile.Shape = 0
  27. missile.BottomSurface = 0
  28. missile.TopSurface = 0
  29. missile.Name = "Spark"
  30. missile.Reflectance = 1
  31.  
  32.  
  33. local force = Instance.new("BodyForce")
  34. force.force = Vector3.new(0,98,0)
  35. force.Parent = missile
  36.  
  37. local creator_tag = Instance.new("ObjectValue")
  38. creator_tag.Value = vPlayer
  39. creator_tag.Name = "creator"
  40. creator_tag.Parent = missile
  41.  
  42. local new_script = script.Parent.Spark:clone()
  43. new_script.Disabled = false
  44. new_script.Parent = missile
  45.  
  46. missile.Parent = game.Workspace
  47. SparkSound:Play()
  48.  
  49. end
  50.  
  51.  
  52.  
  53. function fire(v, humanoid)
  54.  
  55. local vCharacter = Tool.Parent
  56. local vPlayer = game.Players:playerFromCharacter(vCharacter)
  57.  
  58. local numOfSparks = 100
  59.  
  60. local increment = (math.pi *2)/numOfSparks
  61.  
  62. torsoNormal = humanoid.Parent.Torso.CFrame.lookVector
  63. denom = math.abs(torsoNormal.x) + math.abs(torsoNormal.z)
  64. posX = 15 * (torsoNormal.x/denom)
  65. posZ = 15 * (torsoNormal.z/denom)
  66. local pos = Vector3.new(v.x + posX,v.y, v.z + posZ)
  67.  
  68. local hat = humanoid.Parent:FindFirstChild("Electrifying")
  69. -- really make sure they have the right hat :)
  70. if hat ~= nil and hat.className == "Hat" and hat.Handle.Mesh.TextureId == "http://www.roblox.com/asset/?id=15881128" then
  71. numOfSparks = 16
  72. increment = (math.pi * 2)/numOfSparks
  73. end
  74.  
  75. for i = 1, numOfSparks do
  76.  
  77. local angle = increment * i
  78. createSpark(v, pos, vCharacter)
  79. pos = Vector3.new(((pos.x - v.x) * math.cos(angle)) - ((pos.z - v.z) * math.sin(angle)) + v.x, pos.y,((pos.x - v.x) * math.sin(angle)) + ((pos.z - v.z) * math.cos(angle)) + v.z)
  80.  
  81. end
  82.  
  83. end
  84.  
  85.  
  86.  
  87. function staffUp()
  88. Tool.GripForward = Vector3.new(0,0,-1)
  89. Tool.GripRight = Vector3.new(1,0,0)
  90. Tool.GripUp = Vector3.new(0,1,0)
  91. end
  92.  
  93. function staffOut()
  94. Tool.GripForward = Vector3.new(.0976, .00976, -.995)
  95. Tool.GripRight = Vector3.new(.195, -.981, .00952)
  96. Tool.GripUp = Vector3.new(.976, .195, .0976)
  97. end
  98.  
  99. function isTurbo(character)
  100. return character:FindFirstChild("BoltHelm") ~= nil
  101. end
  102.  
  103.  
  104. function onActivated()
  105. if not enabled then
  106. return
  107. end
  108.  
  109. enabled = false
  110.  
  111.  
  112. local character = Tool.Parent;
  113. local humanoid = character.Humanoid
  114. if humanoid == nil then
  115. print("Humanoid not found")
  116. return
  117. end
  118.  
  119. local bodyPos = Instance.new("BodyPosition")
  120. bodyPos.position = Vector3.new(character.Torso.Position.x, character.Torso.Position.y + 10 , character.Torso.Position.z)
  121. bodyPos.maxForce = Vector3.new (10000,10000,10000)
  122. bodyPos.P = 10000
  123. bodyPos.D = 5000
  124. bodyPos.Parent = character.Torso
  125.  
  126. Tool.Handle.ActivateSound:Play()
  127.  
  128. wait(1.5)
  129.  
  130. bodyPos:remove()
  131.  
  132. local targetPos = humanoid.TargetPoint
  133. local lookAt = character.Torso.Position
  134.  
  135. local reload = 0
  136. if (isTurbo(character)) then
  137. reload = 0
  138. print("turbo")
  139. end
  140.  
  141. fire(lookAt, humanoid)
  142. wait(reload)
  143. wait(reload)
  144.  
  145. enabled = true
  146.  
  147. end
  148.  
  149. function onEquipped()
  150. Tool.Handle.EquipSound:play()
  151. end
  152.  
  153. script.Parent.Activated:connect(onActivated)
  154. script.Parent.Equipped:connect(onEquipped)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement