How can I improve this combat system?

I want to improve the effectiveness of this combat system. I was using a touch based melee combat system and paid another scripter’s for this region 3 melee system, but with results like these I can’t believe the touch system wouldn’t be more effective. I’m also considering just building a simple short range ray casting system. Increasing the hitboxes on the server script and on the enemies doesn’t seem to do anything except increase the hit ranges on the side of the player… Does anybody see any ways I could increase the functionality or reliability of these combat scripts or have any other recommendations for a more reliable system?

video of me striking out on monsters at point blank with these scripts.

Server Script:

local debirs = game:GetService("Debris")
game.ReplicatedStorage.Remotes.Attack.OnServerEvent:Connect(function(plr,tool,combo)
    if not plr.Cooldown.Value then
    plr.Cooldown.Value = true
    local confi = tool.Configuration
    local damage = confi.Power.Power1
    local Anim = confi.Anim["Swing"..combo]
    local charpos = plr.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-3).Position
    local pos1 = charpos-Vector3.new(5,5,5)
    local pos2 = charpos+Vector3.new(5,5,5)
    local r3 = Region3.new(pos1,pos2)
    local parts = workspace:FindPartsInRegion3(r3)
    print(Anim.Name)
    local animator =  plr.Character.Humanoid:LoadAnimation(Anim)
    animator:Play()
	wait(animator.Length * .5)	
		
		for i,v in pairs(parts) do 

        if v.Parent:FindFirstChild("HumanoidEvil")and v.Parent ~=plr.Character and not v.Parent:FindFirstChild("gothitby"..plr.Name) then
            local gothit = Instance.new("StringValue")
            gothit.Name = "gothitby"..plr.Name
            gothit.Parent = v.Parent
            debirs:AddItem(gothit,0.4)
            v.Parent.HumanoidEvil:TakeDamage(damage.Value)  --added wait
        end
    end
    coroutine.wrap(function()
        wait(1)
        plr.Cooldown.Value = false
        animator:Stop()
        game.ReplicatedStorage.Remotes.Attack:FireClient(plr)
    end)()
   end
end)

local script in weapons:

local player = game.Players.LocalPlayer
local confi = script.Parent.Configuration
local combo = confi.ComboCount
local max = confi.Combo
local prev = 0
script.Parent.Activated:Connect(function()
    
    if not player.Cooldown.Value and player.Character.Health ~= 0   then
        if combo.Value < max.Value then
        if  tick()-prev<1 or prev == 0 then
            
        combo.Value +=1
        game.ReplicatedStorage.Remotes.Attack:FireServer(script.Parent,combo.Value)
    else
       prev = 0 
      
       combo.Value = 1
       game.ReplicatedStorage.Remotes.Attack:FireServer(script.Parent,combo.Value)
    end
    else
    prev = 0 
   
   
    combo.Value = 1
    game.ReplicatedStorage.Remotes.Attack:FireServer(script.Parent,combo.Value)
    end
        
    end
end)
game.ReplicatedStorage.Remotes.Attack.OnClientEvent:Connect(function()
    prev = tick()
end)

Thank you anybody for any ideas!

Personally, I don’t recommend using Regions for hit detection as they can get performance heavy really fast. Touched events are very unreliable as they might not trigger during fast collisions. So raycasting is honestly your best bet for hit detection.

If you don’t want to make a hit detection system from scratch though, you can use this very good Raycasting module by Swordphin123:

1 Like

Awesome, thanks for the info! I will absolutely check that module out, thank you very much!