Advertisement
Anukun_Lucifer

Sword Script

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