So I’ve been working on a couple of combat abilities for my game and I got stuck on making a barrage ability(Fast punches with arms going in front of character as an effect). I’ve been always using simple hitboxes for abilities with Hitbox.Touched event, but this method is pretty bad for making barrage abilities, the script creates a bunch of hitboxes that touch each other instead of touching the enemy, so the punches are really rare. I don’t want to use the rotated Region3 method, because it’s similar to hitbox and will cause the same issue, so I’m asking you, guys, how to make a raycast hitbox for my barrage ability. If you’re still confused, I mean I want to make a raycast from somewhere of the character, most likely from the “Going arms in front of my character effect”, and when the ray hits the target, the enemy takes damage. The Hitbox and effects can be separate. I have a code example, but it doesn’t work like I wanted it to, rays hit the enemy rarely:
while Barraging do
local pivotCFrame = char.HumanoidRootPart.CFrame * CFrame.new(0,0,-6)
local LArm = char["Left Arm"]:Clone()
LArm:ClearAllChildren()
LArm.CanCollide = false
LArm.Anchored = true
LArm.Parent = Folder
Debris:AddItem(LArm,.25)
local RArm = char["Right Arm"]:Clone()
RArm:ClearAllChildren()
RArm.CanCollide = false
RArm.Anchored = true
RArm.Parent = Folder
Debris:AddItem(RArm,.25)
LArm.CFrame = CFrame.new((char.HumanoidRootPart.CFrame * CFrame.new(math.random(-2,-1.5),0,-1)).p, pivotCFrame.p) * CFrame.Angles(math.rad(90),0,0)
RArm.CFrame = CFrame.new((char.HumanoidRootPart.CFrame * CFrame.new(math.random(1.5,2),0,-1)).p, pivotCFrame.p) * CFrame.Angles(math.rad(90),0,0)
local Tween1 = TS:Create(LArm,TweenInfo.new(.25),{Transparency = 1, CFrame = LArm.CFrame * CFrame.new(0,-3,0)}):Play()
local Tween2 = TS:Create(RArm,TweenInfo.new(.25),{Transparency = 1, CFrame = RArm.CFrame * CFrame.new(0,-3,0)}):Play()
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {char}
rayParams.FilterType = Enum.RaycastFilterType.Blacklist
local L_Start = LArm.CFrame * CFrame.new(0,LArm.Size.Y/2,0)
local R_Start = RArm.CFrame * CFrame.new(0,RArm.Size.Y/2,0)
local rayL = workspace:Raycast(L_Start.p, CFrame.new(L_Start.p, LArm.CFrame.p).lookVector * 6, rayParams)
local rayR = workspace:Raycast(R_Start.p, CFrame.new(R_Start.p, RArm.CFrame.p).lookVector * 6, rayParams)
if rayL then
local eHum = rayL.Instance.Parent:FindFirstChild("Humanoid")
if eHum then
print(eHum.Parent)
end
end
if rayR then
local eHum = rayR.Instance.Parent:FindFirstChild("Humanoid")
if eHum then
print(eHum.Parent)
end
end
wait(.05)
end
Any help is greatly appreciated. Thanks in advance.