Advertisement
moemmoe

Combat Warriors Script

Sep 24th, 2024
5,342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. local lp = game.Players.LocalPlayer
  2.  
  3. local animationInfo = {}
  4.  
  5. function getInfo(id)
  6. local success, info = pcall(function()
  7. return game:GetService("MarketplaceService"):GetProductInfo(id)
  8. end)
  9. if success then
  10. return info
  11. end
  12. return {Name=''}
  13. end
  14. function block(player)
  15. keypress(0x46)
  16. wait()
  17. keyrelease(0x46)
  18. end
  19.  
  20. local AnimNames = {
  21. 'Slash',
  22. 'Swing',
  23. 'Sword'
  24. }
  25.  
  26. function playerAdded(v)
  27. local function charadded(char)
  28. local humanoid = char:WaitForChild("Humanoid", 5)
  29. if humanoid then
  30. humanoid.AnimationPlayed:Connect(function(track)
  31. local info = animationInfo[track.Animation.AnimationId]
  32. if not info then
  33. info = getInfo(tonumber(track.Animation.AnimationId:match("%d+")))
  34. animationInfo[track.Animation.AnimationId] = info
  35. end
  36.  
  37. if (lp.Character and lp.Character:FindFirstChild("Head") and v.Character:FindFirstChild("Head")) then
  38. local mag = (v.Character.Head.Position - lp.Character.Head.Position).Magnitude
  39. if mag < 15 then
  40.  
  41. for _, animName in pairs(AnimNames) do
  42. if info.Name:match(animName) then
  43. pcall(block, v)
  44. end
  45. end
  46.  
  47. end
  48. end
  49. end)
  50. end
  51. end
  52.  
  53. if v.Character then
  54. charadded(v.Character)
  55. end
  56. v.CharacterAdded:Connect(charadded)
  57. end
  58.  
  59. for i,v in pairs(game.Players:GetPlayers()) do
  60. if v ~= lp then
  61. playerAdded(v)
  62. end
  63. end
  64.  
  65. game.Players.PlayerAdded:Connect(playerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement