Hello, I am having troubles with my Combat System. I am trying to Query or Detect Players When The Sword Swings but the problem is that I’m struggling with the hitbox detecting the actual enemy. I want to query or get all the parts in the hitbox during the entire duration of the swing but using while loops, waits, and task.wait() completetly breaks this script and allows the player to swing multiple times, when the original script works perfectly with the cooldown.
if (tick() - PlayerStates[player.Name].LastM1) > 0.6 then
local HitBox = player.Character:FindFirstChild(ArisenProfiles[player].EquippedItem):FindFirstChild("HitBox")
local SwingAnimation = player.Character:FindFirstChildOfClass("Humanoid"):FindFirstChildOfClass("Animator"):LoadAnimation(game.ServerStorage.WeaponAnimations:FindFirstChild(ArisenProfiles[player].EquippedItem).Swing1R)
SwingAnimation:Play()
HitBox.Color = Color3.new(1, 0, 0.0156863)
-- Add Solution Code Here
HitBox.Color = Color3.new(1, 1, 1)
PlayerStates[player.Name].LastM1 = tick()
If anybody can share a solution to this problem without using raycasts, and using the hitbox system would be greatly appericated.
Thanks,
Zentuz