Advertisement
Anukun_Lucifer

Sword script (Tool,Animation,Take Damage )

Jul 23rd, 2022
5,594
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 1 0
  1. local tool = script.Parent
  2. local handle = tool:WaitForChild("Handle")
  3. local slash = script:WaitForChild("slash")
  4. local debounce = false
  5. local playersHit = {}
  6. local up = game.Workspace.SwordFF.Sword.Up
  7. --Anim
  8. tool.Activated:Connect(function()
  9.     if debounce == false then
  10.         debounce = true
  11.        
  12.         local humanoid = tool.Parent:WaitForChild("Humanoid")
  13.         local AnimTrack = humanoid:LoadAnimation(slash)
  14.         AnimTrack:Play(wait(AnimTrack))
  15.         wait(1)
  16.         debounce = false
  17.     end
  18. end)
  19.  
  20. --Damage
  21. up.Touched:Connect(function(Hit)
  22.     if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= tool.Parent then
  23.         if debounce == true and playersHit[Hit.Parent] == nil then
  24.             Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(25)
  25.             playersHit[Hit.Parent] = true
  26.             wait(1)
  27.             playersHit[Hit.Parent] = nil
  28.         end
  29.     end
  30. end)
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement