Reactor4

yeetttt

Mar 1st, 2021
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. --Axe script
  2.  
  3. Properties = {
  4. debounce = true, -- Leave this on true.
  5. sound_fx = true, -- If you don't want sound to play when tool is activated set this to false.
  6. anim_check = true, -- If you don't want animation to play when tool is activated set this to false.
  7. ToolDrop = false, -- Set this to true if you want to be able to drop the tool by pressing BackSpace.
  8. soundID = 6042531284, -- Sound Id.
  9. AnimID = 6461572129, -- Your Animtion id.
  10. debounce_lenght = 1, -- how long it will take before you can click again, aka cooldown so you can't spam click the tool.
  11. soundDelay = 0.25, -- How long to wait before playing sound
  12. enableTrail = true, -- Enable trail thing
  13. trail = script.Parent.Head.Trail, -- the trail thing
  14. damage = 5 -- how much dmg the thing does
  15. }
  16.  
  17. local Tool = script.Parent
  18. local Handle = Tool:WaitForChild("Handle")
  19. local BaseUrl = "rbxassetid://"
  20. local anim = Tool:WaitForChild("Animation")
  21. local Players = game:GetService("Players")
  22. local debounce = false
  23. local UsesLeft = script.Parent.UsesLeft.Value
  24.  
  25. if Properties.sound_fx then
  26. sound = Handle:WaitForChild("Sound")
  27. sound.SoundId = BaseUrl .. Properties.soundID
  28. sound.MaxDistance = 100
  29. sound.RollOffMode = Enum.RollOffMode.InverseTapered
  30. end
  31.  
  32.  
  33.  
  34. if Properties.anim_check then
  35. anim.AnimationId = BaseUrl .. Properties.AnimID
  36. end
  37.  
  38.  
  39. if Properties.ToolDrop == true then
  40. Tool.CanBeDropped = true
  41. end
  42.  
  43. Tool.Equipped:Connect(function(Mouse) -- When you equip the tool
  44. local player = Players:GetPlayerFromCharacter(Tool.Parent) -- gets the player
  45. if Properties.anim_check == true then animation = player.Character.Humanoid:LoadAnimation(anim)end -- loads animation
  46.  
  47. Tool.Activated:Connect(function() -- when you click with the tool
  48. if Properties.debounce then
  49. Properties.debounce = false
  50. if Properties.anim_check == true then animation:Play()end
  51. if Properties.sound_fx == true then wait(Properties.soundDelay) sound:Play()end
  52.  
  53. if Properties.enableTrail == true then
  54. Properties.trail.Enabled = true
  55. wait(0.2)
  56. Properties.trail.Enabled = false
  57. end
  58.  
  59.  
  60. script.Parent.Head.Touched:Connect(function(Hit)
  61. --print(Hit.Name)
  62. if Hit:FindFirstChildWhichIsA("NumberValue") and Hit:FindFirstChildWhichIsA("NumberValue").Name == "Health" then
  63. local temp = Hit:FindFirstChildWhichIsA("NumberValue")
  64. --print(temp.Name .. ": " .. temp.Value)
  65. if debounce == false then
  66. debounce = true
  67. Hit:FindFirstChildWhichIsA("Sound"):Play()
  68. UsesLeft = UsesLeft - 1
  69. wait(0.18)
  70. temp.Value = temp.Value - Properties.damage
  71. wait(1)
  72. debounce = false
  73. end
  74.  
  75. end
  76. end)
  77.  
  78. wait(Properties.debounce_lenght)
  79. Properties.debounce = true
  80. end
  81. end)
  82. end)
  83. Tool.Unequipped:Connect(function()
  84. if Properties.anim_check == true then animation:Stop()end
  85. if Properties.sound_fx then sound:Stop()end
  86. end)
  87. local bruhMoment = false
  88. while true do
  89.  
  90. wait()
  91. if UsesLeft <= 0 and bruhMoment == false then
  92. bruhMoment = true
  93. local bruhSound = script.Parent.BreakSound:Clone()
  94. bruhSound.Parent = script.Parent.Parent
  95. bruhSound.Bruh.Disabled = false
  96. wait(0.01)
  97. script.Parent:Destroy()
  98. end
  99. end
  100.  
  101. -- Ze bar script that show durability
  102.  
  103. local bar = script.Parent
  104.  
  105.  
  106. while true do
  107. wait()
  108. local UsesLeft = script.Parent.Parent.Parent.Parent.Parent.UsesLeft.Value
  109. bar.Size = UDim2.new(UsesLeft/15,0,1,0)
  110. end
Advertisement
Add Comment
Please, Sign In to add comment