Advertisement
ElliscecieCreates

ClientSource - Kali - SpartanGear CB

Jun 10th, 2025 (edited)
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.62 KB | Gaming | 0 0
  1. -- //interface variables
  2. local player = game:GetService("Players").LocalPlayer
  3. local character = player.Character
  4. local humanoid = character:WaitForChild("Humanoid")
  5. local animator = humanoid:WaitForChild("Animator") or humanoid:WaitForChild("AnimationController")
  6. local sprintHoldingWeapon = character:WaitForChild("Sprint"):WaitForChild("HoldingWeapon")
  7. local playerGui = player:WaitForChild("PlayerGui")
  8. local humRoot = character:WaitForChild("HumanoidRootPart")
  9.  
  10. -- //services
  11. local userInput = game:GetService("UserInputService")
  12. local repStorage = game:GetService("ReplicatedStorage")
  13. local starterGui = game:GetService("StarterGui")
  14. local runService = game:GetService("RunService")
  15.  
  16. -- //service folders
  17. local animationsFolder = script.Parent:WaitForChild("Animations")
  18. local soundsFolder = script.Parent:WaitForChild("Sounds")
  19. local eventsFolder = script.Parent:WaitForChild("Events")
  20. local hapticsFolder = script.Parent:WaitForChild("Haptics")
  21. local valuesFolder = script.Parent:WaitForChild("Values")
  22.  
  23. -- //keyboard controls
  24. local defaultHeavyKeyboard = Enum.UserInputType.MouseButton2 -- MOUSE BUTTONS ONLY. TO CHANGE: // Enum.Keycode.{key}
  25. local defaultDodgeKeyboard = Enum.KeyCode.Q -- FOR DODGE CONTROL, YOU MUST ALSO CHANGE IN SPRINT SCRIPT: StarterPlayer\StarterCharacterScripts\Sprint
  26. local defaultSpecialKeyboard = Enum.KeyCode.R
  27. local defaultBlockKeyboard = Enum.KeyCode.F
  28. -- // //keyboard controls ui
  29. local keyboardControlsGroup = playerGui:WaitForChild("OtherButtons"):WaitForChild("KeyboardControls")
  30.  
  31. local uikbDash = keyboardControlsGroup:WaitForChild("Dash")
  32. local uikbcbDash = keyboardControlsGroup:WaitForChild("CombatDash")
  33. local uikbEmotes = keyboardControlsGroup:WaitForChild("Emotes")
  34. local uikbcbAttack = keyboardControlsGroup:WaitForChild("CombatAttack")
  35. local uikbcbSpecial = keyboardControlsGroup:WaitForChild("CombatSpecialAtt")
  36. local uikbcbBlock = keyboardControlsGroup:WaitForChild("CombatBlock")
  37. local uikbcbHeavy = keyboardControlsGroup:WaitForChild("CombatHeavyAtt")
  38. local uikbSprint = keyboardControlsGroup:WaitForChild("Sprint")
  39.  
  40. -- //gamepad controls
  41. local defaultHeavyGamepad = Enum.KeyCode.ButtonL2
  42. local defaultDodgeGamepad = Enum.KeyCode.ButtonL3 -- FOR DODGE CONTROL, YOU MUST ALSO CHANGE IN SPRINT SCRIPT: StarterPlayer\StarterCharacterScripts\Sprint
  43. local defaultSpecialGamepad = Enum.KeyCode.ButtonX
  44. local defaultBlockGamepad = Enum.KeyCode.ButtonB
  45. -- // //gamepad controls ui
  46. local gamepadControlsGroup = playerGui:WaitForChild("OtherButtons"):WaitForChild("GamepadControls")
  47.  
  48. local uigpDash = gamepadControlsGroup:WaitForChild("Dash")
  49. local uigpcbDash = gamepadControlsGroup:WaitForChild("CombatDash")
  50. local uigpEmotes = gamepadControlsGroup:WaitForChild("Emotes")
  51. local uigpcbAttack = gamepadControlsGroup:WaitForChild("CombatAttack")
  52. local uigpcbSpecial = gamepadControlsGroup:WaitForChild("CombatSpecialAtt")
  53. local uigpcbBlock = gamepadControlsGroup:WaitForChild("CombatBlock")
  54. local uigpcbHeavy = gamepadControlsGroup:WaitForChild("CombatHeavyAtt")
  55. local uigpSprint = gamepadControlsGroup:WaitForChild("Sprint")
  56.  
  57. -- //touch controls ui
  58. local touchControlsGroup = playerGui:WaitForChild("MobileButtons"):WaitForChild("MobileControls")
  59.  
  60. local uitmcbHeavy = touchControlsGroup:WaitForChild("AttackHeavy")
  61. local uitmcbSprint = touchControlsGroup:WaitForChild("Sprint")
  62. local uitmEmotes = touchControlsGroup:WaitForChild("Emotes")
  63. local uitmcbSpecial = touchControlsGroup:WaitForChild("AttackSpecial")
  64. local uitmcbBlock = touchControlsGroup:WaitForChild("Block")
  65.  
  66. -- //events
  67. local playerOpponentHit = eventsFolder:WaitForChild("PlayerOpponentHit")
  68. local playerBlockedAttack = eventsFolder:WaitForChild("PlayerBlockedAttack")
  69. local dialAttack = eventsFolder:WaitForChild("DialAttack")
  70. local dialAttackHeavy = eventsFolder:WaitForChild("DialHeavy")
  71. local dialAttackSpecial = eventsFolder:WaitForChild("DialSpecial")
  72. local beginBlocking = eventsFolder:WaitForChild("BeginBlocking")
  73. local endBlocking = eventsFolder:WaitForChild("EndBlocking")
  74. local dialDodge = eventsFolder:WaitForChild("DialDodge")
  75. local destroyBlockOpp = eventsFolder:WaitForChild("DestroyBlockOpp")
  76. local resetCombo = eventsFolder:WaitForChild("ResetCombo")
  77. local destroyBlockPlayer = eventsFolder:WaitForChild("DestroyBlockPlayer")
  78.  
  79. -- //haptics
  80. local blockIncomiongAttackHaptic = hapticsFolder:WaitForChild("BlockHit")
  81. local blockBrokenHaptic = hapticsFolder:WaitForChild("BlockBroken")
  82. local damagedOpponentHaptic = hapticsFolder:WaitForChild("DamagedOpponent")
  83. local equipDuoHaptic = hapticsFolder:WaitForChild("EquipDuo")
  84. local attackAttemptHaptic = hapticsFolder:WaitForChild("AttackAttempt")
  85. local playerHit = hapticsFolder:WaitForChild("PlayerHit")
  86.  
  87. -- //sounds
  88. local attackSound1 = soundsFolder:WaitForChild("Attack1")
  89. local attackSound2 = soundsFolder:WaitForChild("Attack2")
  90. local attackSound3 = soundsFolder:WaitForChild("Attack3")
  91. local attackSound4 = soundsFolder:WaitForChild("Attack4")
  92. local blockSound1 = soundsFolder:WaitForChild("Block1")
  93. local blockSound2 = soundsFolder:WaitForChild("Block2")
  94. local equipSound = soundsFolder:WaitForChild("Equip")
  95. local unequipSound = soundsFolder:WaitForChild("Unequip")
  96. local hitSound1 = soundsFolder:WaitForChild("Hit1")
  97. local hitSound2 = soundsFolder:WaitForChild("Hit2")
  98. local specialAttack = soundsFolder:WaitForChild("SpecialAttack")
  99. local specialHit = soundsFolder:WaitForChild("SpecialHit")
  100.  
  101. -- //anim presets
  102. local attackPreset1 = animationsFolder:WaitForChild("Attack1")
  103. local attackPreset2 = animationsFolder:WaitForChild("Attack2")
  104. local attackPreset3 = animationsFolder:WaitForChild("Attack3")
  105. local blockPreset = animationsFolder:WaitForChild("Block")
  106. local dodgePreset = animationsFolder:WaitForChild("DodgeDash")
  107. local equipPreset = animationsFolder:WaitForChild("EquipDuo")
  108. local heavyAttackPreset1 = animationsFolder:WaitForChild("HeavyAttack1")
  109. local heavyAttackPreset2 = animationsFolder:WaitForChild("HeavyAttack2")
  110. local idlePreset = animationsFolder:WaitForChild("Idle")
  111. local specialAttackPreset = animationsFolder:WaitForChild("SpecialAttack")
  112. local unequipPreset = animationsFolder:WaitForChild("UnequipDuo")
  113.  
  114. -- //animations
  115. local attackAnim = animator:LoadAnimation(attackPreset1)
  116. local attackAnim2 = animator:LoadAnimation(attackPreset2)
  117. local attackAnim3 = animator:LoadAnimation(attackPreset3)
  118. local blockAnim = animator:LoadAnimation(blockPreset)
  119. --local dodgeAnim = animator:LoadAnimation(dodgePreset)
  120. local equipAnim = animator:LoadAnimation(equipPreset)
  121. local heavyAttackAnim1 = animator:LoadAnimation(heavyAttackPreset1)
  122. local heavyAttackAnim2 = animator:LoadAnimation(heavyAttackPreset2)
  123. local idleAnim = animator:LoadAnimation(idlePreset)
  124. local specialAttackAnim = animator:LoadAnimation(specialAttackPreset)
  125. local unequipAnim = animator:LoadAnimation(unequipPreset)
  126.  
  127. specialAttackAnim.Priority = Enum.AnimationPriority.Action4
  128.  
  129. -- //values and variables
  130. -- // //cooldown variables
  131. local attackCooldown = valuesFolder:WaitForChild("AttackCooldown")
  132. local heavyCooldown = valuesFolder:WaitForChild("HeavyCooldown")
  133. local specialCooldown = valuesFolder:WaitForChild("SpecialCooldown")
  134. local blockCooldown = valuesFolder:WaitForChild("BlockCooldown")
  135. local blockBrokenShield = valuesFolder:WaitForChild("BlockBrokenCooldown")
  136. local dodgeSyncCooldown = valuesFolder:WaitForChild("DodgeDashCooldown")
  137. local blockPower = valuesFolder:WaitForChild("BlockPower")
  138. local maxBlockPower = valuesFolder:WaitForChild("MaxBlockPower")
  139.  
  140. -- // //attack variables
  141. local canAttack = true
  142. local canDodge = true
  143. local canDuck = true
  144. local canSpecial = true
  145. local canBlock = true
  146.  
  147. -- // //defense variables
  148. local isBlocking = false
  149. local isDodging = false
  150. local isAttacking = false
  151. local toolEquipped = false
  152.  
  153. local currentAttack = 1
  154. script.Parent.Activated:Connect(function()
  155.     if canAttack and not isBlocking and not isDodging then
  156.         canAttack = false
  157.         dialAttack:FireServer()
  158.         if currentAttack == 1 then
  159.             attackAnim:Play()
  160.             attackSound1:Play()
  161.             currentAttack = 2
  162.         elseif currentAttack == 2 then
  163.             attackAnim2:Play()
  164.             attackSound2:Play()
  165.             currentAttack = 3
  166.         elseif currentAttack == 3 then
  167.             attackAnim3:Play()
  168.             attackSound3:Play()
  169.             currentAttack = 1
  170.         end
  171.         attackAttemptHaptic:Play()
  172.         task.wait(attackCooldown.Value)
  173.         canAttack = true
  174.     else
  175.         return false;
  176.     end
  177. end)
  178. script.Parent.Equipped:Connect(function()
  179.     toolEquipped = true
  180.     equipSound:Play()
  181.     equipAnim:Play()
  182.     idleAnim:Play()
  183.     sprintHoldingWeapon.Value = true
  184.    
  185.     sprintHoldingWeapon.Parent:WaitForChild("SGearDashCooldown").Value = dodgeSyncCooldown.Value
  186.    
  187.     uikbDash.Visible = false
  188.     uikbcbDash.Visible = true
  189.     uikbEmotes.Visible = false
  190.     uikbcbAttack.Visible = true
  191.     uikbcbSpecial.Visible = true
  192.     uikbcbBlock.Visible = true
  193.     uikbcbHeavy.Visible = true
  194.     uikbSprint.Visible = false
  195.    
  196.     uigpDash.Visible = false
  197.     uigpcbDash.Visible = true
  198.     uigpEmotes.Visible = false
  199.     uigpcbAttack.Visible = true
  200.     uigpcbSpecial.Visible = true
  201.     uigpcbBlock.Visible = true
  202.     uigpcbHeavy.Visible = true
  203.     uigpSprint.Visible = false
  204.    
  205.     uitmcbHeavy.Visible = true
  206.     uitmcbSprint.Image = "rbxassetid://83841678364163"
  207.     uitmEmotes.Visible = false
  208.     uitmcbSpecial.Visible = true
  209.     uitmcbBlock.Visible = true
  210. end)
  211. script.Parent.Unequipped:Connect(function()
  212.     unequipSound:Play()
  213.     idleAnim:Stop()
  214.     unequipAnim:Play()
  215.     toolEquipped = false
  216.     sprintHoldingWeapon.Value = false
  217.    
  218.     sprintHoldingWeapon.Parent:WaitForChild("SGearDashCooldown").Value = 0
  219.    
  220.     uikbDash.Visible = true
  221.     uikbcbDash.Visible = false
  222.     uikbEmotes.Visible = true
  223.     uikbcbAttack.Visible = false
  224.     uikbcbSpecial.Visible = false
  225.     uikbcbBlock.Visible = false
  226.     uikbcbHeavy.Visible = false
  227.     uikbSprint.Visible = true
  228.    
  229.     uigpDash.Visible = true
  230.     uigpcbDash.Visible = false
  231.     uigpEmotes.Visible = true
  232.     uigpcbAttack.Visible = false
  233.     uigpcbSpecial.Visible = false
  234.     uigpcbBlock.Visible = false
  235.     uigpcbHeavy.Visible = false
  236.     uigpSprint.Visible = true
  237.    
  238.     uitmcbHeavy.Visible = false
  239.     uitmcbSprint.Image = "rbxassetid://73337704931687"
  240.     uitmEmotes.Visible = true
  241.     uitmcbSpecial.Visible = false
  242.     uitmcbBlock.Visible = false
  243. end)
  244.  
  245. function blockFunction() --block
  246.     if canBlock then
  247.         blockAnim:Play()
  248.         beginBlocking:FireServer()
  249.         isBlocking = true
  250.         canBlock = false
  251.     else
  252.         return false;
  253.     end
  254. end
  255. function specialAttack() --special
  256.     if canSpecial and not isDodging and not isBlocking then
  257.         specialAttackAnim:Play()
  258.         dialAttackSpecial:FireServer()
  259.         destroyBlockOpp:FireServer()
  260.         canSpecial = false
  261.         task.wait(specialCooldown.Value)
  262.         canSpecial = true
  263.     else
  264.         return false;
  265.     end
  266. end
  267. local currentHeavyAttack = 1
  268. function heavyAttack()
  269.     if canAttack and not isDodging and not isBlocking then
  270.         canAttack = false
  271.         humanoid.WalkSpeed = 0
  272.         sprintHoldingWeapon.Parent:WaitForChild("HeavyAttacking").Value = true
  273.         dialAttackHeavy:FireServer()
  274.         uitmcbHeavy.Visible = false
  275.         if currentHeavyAttack == 1 then
  276.             heavyAttackAnim1:Play()
  277.             currentHeavyAttack = 2
  278.         else
  279.             heavyAttackAnim2:Play()
  280.             currentHeavyAttack = 1
  281.         end
  282.         task.wait(heavyCooldown.Value)
  283.         uitmcbHeavy.Visible = true
  284.         humanoid.WalkSpeed = 6
  285.         canAttack = true
  286.         sprintHoldingWeapon.Parent:WaitForChild("HeavyAttacking").Value = false
  287.     else
  288.         script.Parent:Activate()
  289.     end
  290. end
  291. function dodgeRequest()
  292.     if canDodge then
  293.         canDodge = false
  294.         dialDodge:FireServer()
  295.         task.wait(dodgeSyncCooldown.Value)
  296.     else
  297.         return false;
  298.     end
  299. end
  300. function endBlockFunction() --block
  301.     if isBlocking then
  302.         blockAnim:Stop()
  303.         endBlocking:FireServer()
  304.         isBlocking = false
  305.         task.wait(blockCooldown.Value)
  306.         canBlock = true
  307.     end
  308. end
  309. function playerBlockBroken() --special attack recieved and is blocking
  310.     if canBlock or isBlocking then
  311.         blockAnim:Stop()
  312.         endBlocking:FireServer()
  313.         isBlocking = false
  314.         canBlock = false
  315.         wait(blockBrokenShield.Value)
  316.         canBlock = true
  317.     else
  318.         return false;
  319.     end
  320. end
  321.  
  322. userInput.InputBegan:Connect(function(input)
  323.     if toolEquipped then
  324.         if input.KeyCode == defaultBlockKeyboard or input.KeyCode == defaultBlockGamepad then --block
  325.             blockFunction()
  326.         elseif input.KeyCode == defaultSpecialKeyboard or input.KeyCode == defaultSpecialGamepad then --special
  327.             specialAttack()
  328.         elseif input.KeyCode == defaultDodgeKeyboard or input.KeyCode == defaultSpecialGamepad then --ready dodge
  329.             dodgeRequest()
  330.         elseif input.UserInputType == defaultHeavyKeyboard or input.KeyCode == defaultHeavyGamepad then --heavy attack
  331.             heavyAttack()
  332.         end
  333.     else
  334.         return false;
  335.     end
  336. end)
  337. userInput.InputEnded:Connect(function(input)
  338.     if toolEquipped then
  339.         if input.KeyCode == defaultBlockKeyboard or input.KeyCode == defaultBlockGamepad then --block
  340.             endBlockFunction()
  341.         elseif input.KeyCode == defaultSpecialKeyboard or input.KeyCode == defaultSpecialGamepad then --special
  342.             specialAttack()
  343.         elseif input.KeyCode == defaultDodgeKeyboard or input.KeyCode == defaultDodgeGamepad then --ready dodge
  344.             print("tool dodge specification ended")
  345.         elseif input.UserInputType == defaultHeavyKeyboard or input.KeyCode == defaultHeavyGamepad then --heavy attack
  346.             print("heavy attack ended")
  347.         end
  348.     else
  349.         return false;
  350.     end
  351. end)
  352. uitmcbHeavy.Activated:Connect(function()
  353.     heavyAttack()
  354. end)
  355. uitmcbSpecial.Activated:Connect(function()
  356.     specialAttack()
  357. end)
  358. uitmcbBlock.Activated:Connect(function()
  359.     if not isBlocking then
  360.         blockFunction()
  361.     else
  362.         endBlockFunction()
  363.     end
  364. end)
  365.  
  366. local wasBroken = valuesFolder:WaitForChild("BlockWasBroken").Value
  367.  
  368. while task.wait(0.1) do
  369.     if blockPower.Value <= 0 and not wasBroken then
  370.         blockPower.Value = 0
  371.         playerBlockBroken()
  372.         wasBroken = true
  373.     elseif blockPower.Value > 0 and wasBroken then
  374.         -- Reset once the block starts regenerating
  375.         wasBroken = false
  376.     end
  377. end
  378.  
Tags: combat Melee
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement