GangHaning

anime123

Apr 2nd, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | None | 0 0
  1. --Made by OpTic Wisdom/LikeATrollFace
  2.  
  3. game:GetObjects("rbxassetid://497382476")[1].Parent=game.Players.LocalPlayer.Backpack
  4.  
  5. BoomSound = Instance.new("Sound" ,game.Players.LocalPlayer.Backpack["Sword Execution"])
  6. BoomSound.SoundId = "rbxasset://sounds/Rocket shot.wav"
  7. BoomSound.Name = "Boom"
  8. BeepSound = Instance.new("Sound" ,game.Players.LocalPlayer.Backpack["Sword Execution"])
  9. BeepSound.SoundId = "http://www.roblox.com/asset/?id=94137771"
  10. BeepSound.Name = "Beep"
  11. SwordAnim = Instance.new("Animation" ,game.Players.LocalPlayer.Backpack["Sword Execution"])
  12. SwordAnim.AnimationId = "http://www.roblox.com/Asset?ID=89289879"
  13. SwordAnim.Name = "AxeSwing"
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. local Tool = game.Players.LocalPlayer.Backpack["Sword Execution"];
  22.  
  23. enabled = true
  24. function onButton1Down(mouse)
  25. if not enabled then
  26. return
  27. end
  28.  
  29. enabled = false
  30. mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
  31.  
  32. wait(1)
  33. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  34. enabled = true
  35.  
  36. end
  37.  
  38. function onEquippedLocal(mouse)
  39.  
  40. if mouse == nil then
  41. print("Mouse not found")
  42. return
  43. end
  44.  
  45. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  46. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  47. end
  48.  
  49.  
  50. Tool.Equipped:connect(onEquippedLocal)
  51.  
  52. --[[Super Util]]--
  53. function WaitForChild(parent,child)
  54. while not parent:FindFirstChild(child) do wait(1/30) end
  55. return parent[child]
  56. end
  57.  
  58. function MakeValue(class,name,value,parent)
  59. local temp = Instance.new(class)
  60. temp.Name = name
  61. temp.Value = value
  62. temp.Parent = parent
  63. return temp
  64. end
  65.  
  66. function TweenProperty(obj, propName, inita, enda, length)
  67. local startTime = tick()
  68. while startTime - tick()<length do
  69. obj[propName] = (startTime - tick())/length
  70. wait(1/30)
  71. end
  72. obj[propName] = enda
  73. end
  74.  
  75. local function weldBetween(a, b)
  76. local weld = Instance.new("ManualWeld")
  77. weld.Part0 = a
  78. weld.Part1 = b
  79. weld.C0 = CFrame.new()
  80. weld.C1 = b.CFrame:inverse() * a.CFrame
  81. weld.Parent = a
  82. return weld;
  83. end
  84.  
  85. --[[Constants]]--
  86. local COOLDOWN=.5
  87. local SWING_COOLDOWN = 2.5
  88. local DAMAGE = 99
  89. --[[Workspace Variables]]--
  90.  
  91. local Tool = game.Players.LocalPlayer.Backpack["Sword Execution"]
  92. local Handle = WaitForChild(game.Players.LocalPlayer.Backpack["Sword Execution"],'Handle')
  93. local SwingAni = WaitForChild(Tool,'AxeSwing')
  94. local SwingAniTrack = nil
  95. local SwingSound = WaitForChild(Handle,'Swing')
  96. local ExplodeSound = WaitForChild(Tool,'Boom')
  97. local BeepSound = WaitForChild(Tool,'Beep')
  98.  
  99. local lastSwing = 0
  100.  
  101. --[[Script Variables]]--
  102.  
  103. local lastHit = tick()
  104. local lastDamage = tick()
  105. --[[Script Functions]]--
  106.  
  107. function flashColor(obj,color)
  108. if obj:IsA('Part') then
  109. obj.BrickColor = BrickColor.new(color)
  110. elseif obj:IsA('FileMesh') then
  111. obj.VertexColor=Vector3.new(color.r*3,color.g*3,color.b*3)
  112. end
  113. for _,i in pairs(obj:GetChildren()) do
  114. flashColor(i,color)
  115. end
  116. end
  117.  
  118.  
  119. Handle.Touched:connect(function(part)
  120. if part.Parent == Tool.Parent then return end
  121. if not part.Parent:FindFirstChild('Humanoid') then return end
  122. if part.Parent:FindFirstChild('ForceField') then return end
  123. if tick()-lastDamage < COOLDOWN then return end
  124. if tick()-lastSwing>SWING_COOLDOWN then return end
  125. lastDamage=tick()
  126. part.Parent.Humanoid:TakeDamage(DAMAGE)
  127. if not part.Parent:FindFirstChild('Head') then return end
  128. if part.Parent.Head.Transparency==1 then return end
  129. SwingSound:Play()
  130. lastHit=tick()
  131. local nhead=part.Parent.Head:Clone()
  132. for _,i in pairs(part.Parent:GetChildren()) do
  133. if i:IsA('Hat') and i:FindFirstChild('Handle') then
  134. local that =i.Handle
  135. that.Parent = nhead
  136. weldBetween(nhead,that)
  137. i:Destroy()
  138. end
  139. end
  140.  
  141. part.Parent.Head.Transparency=1
  142. part.Parent.Head:ClearAllChildren()
  143. nhead.Velocity = Vector3.new(math.random()*25-15,25,math.random()*25-15)
  144. nhead.Parent = game.Workspace
  145. local nbeep = BeepSound:Clone()
  146. nbeep.Parent = nhead
  147. salil = Instance.new("Sound", game.Players.LocalPlayer.Character.Head)
  148. salil.Name = "salil"
  149. salil.Volume = 100
  150. salil.SoundId = "rbxassetid://403330704"
  151. salil:Play()
  152. for i=1,10,1 do
  153. flashColor(nhead,Color3.new(1,0,0))
  154. nbeep:Play()
  155. wait(1/i)
  156. flashColor(nhead,Color3.new(1,1,1))
  157. wait(1/i)
  158. end
  159. local nsound = ExplodeSound:Clone()
  160. nsound.Parent = nhead
  161. nsound:Play()
  162. salil:Pause()
  163. salil:Destroy()
  164. local explode = Instance.new('Explosion')
  165. explode.Position = nhead.CFrame.p
  166. explode.Parent = nhead
  167. game.Debris:AddItem(nhead,1)
  168. end)
  169.  
  170.  
  171. --[[Running Logic]]--
  172.  
  173. Tool.Activated:connect(function()
  174. if tick()-lastSwing<SWING_COOLDOWN then return end
  175. lastSwing = tick()
  176. if not SwingAniTrack then
  177. local player = Tool.Parent
  178. local humanoid = player:FindFirstChild('Humanoid')
  179. SwingAniTrack = humanoid:LoadAnimation(SwingAni)
  180. end
  181. SwingAniTrack:Play()
  182. end)
  183.  
  184. Tool.Unequipped:connect(function()
  185. if SwingAniTrack then
  186. SwingAniTrack:Stop()
  187. SwingAniTrack:Destroy()
  188. end
  189. end)
Add Comment
Please, Sign In to add comment