Advertisement
alexhernandezroblox

Untitled

Apr 22nd, 2025
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.56 KB | None | 0 0
  1. local RepStorage = game.ReplicatedStorage
  2. local ServerStorage = game.ServerStorage
  3. local AttackHandler = require(RepStorage.AttackHandler) -- I didn't want this script being too long so I did all the damage and stuff in a module
  4. local Keybinds = require(RepStorage.Keybinds) -- keybinds module for damage and stuff
  5. local Moves = Keybinds.Moves
  6. local SFXFolder = ServerStorage.SFX
  7. local Players = game.Players
  8.  
  9. -- Remotes
  10. local Remotes = RepStorage.Remotes
  11.  
  12. -- Bindables
  13. local Bindables = RepStorage.Bindables
  14.  
  15. --Block Bar Regeneration
  16. game:GetService("RunService").Heartbeat:Connect(function(deltaTime) -- regenerating block bar. lets say someone gets hit like until their blockbar is at 50%, you want it to go down after 8 seconds of no combat right? so yeah
  17.     for i, player: Player in Players:GetChildren() do
  18.         local char = player.Character
  19.         if not char then continue end
  20.         local LastCombat = char:GetAttribute("LastCombat")
  21.         if not LastCombat then continue end
  22.         if os.clock() - LastCombat <= 8 then continue end
  23.         local BlockBar = char:GetAttribute("BlockBar")
  24.         if not BlockBar then continue end
  25.         if BlockBar < 0 then
  26.             char:SetAttribute("BlockBar", 0)
  27.             continue
  28.         end
  29.         if BlockBar == 0 then continue end
  30.         char:SetAttribute("BlockBar", BlockBar - (math.ceil(deltaTime*200)/100))
  31.     end
  32. end)
  33.  
  34. -- Move Classes
  35. local BoxerMoves = Moves.Boxer
  36.  
  37. Remotes.Jab.OnServerEvent:Connect(function(...) -- boxing jab, this just puts all arguments into one like current combo and stuff and sends it to the module script that actually has all the scripting for damage and stuff
  38.     AttackHandler.Jab(...)
  39. end)
  40.  
  41. Remotes.Uppercut.OnServerEvent:Connect(function(...)
  42.     AttackHandler.Uppercut(...)
  43. end)
  44.  
  45. Remotes.Block.OnServerEvent:Connect(function(plr, val)
  46.     local char = plr.Character
  47.     if val then
  48.         char.Humanoid.WalkSpeed = 4
  49.         print("hes blocking")
  50.     elseif not plr.Character:GetAttribute("BlockBroken") then
  51.         char.Humanoid.WalkSpeed = 16
  52.     end
  53.     char:SetAttribute("Blocking", val)
  54.     if char:GetAttribute("Cooldown") > os.clock() then
  55.         char:SetAttribute("Blocking", false)
  56.     end
  57.     print("set to",val)
  58. end)
  59.  
  60. Bindables.Jab.Event:Connect(function(...)
  61.     AttackHandler.Jab(...)
  62. end)
  63.  
  64. Bindables.Uppercut.Event:Connect(function(...)
  65.     AttackHandler.Uppercut(...)
  66. end)
  67.  
  68. Bindables.Block.Event:Connect(function(char, val)
  69.     if val then
  70.         char.Humanoid.WalkSpeed = 4
  71.     else
  72.         char.Humanoid.WalkSpeed = 16
  73.     end
  74.     char:SetAttribute("Blocking", val)
  75.     if char:GetAttribute("Cooldown") > os.clock() then
  76.         char:SetAttribute("Blocking", false)
  77.     end
  78.     print("set to",val)
  79. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement