I want to make a hitbox for my attack but I don’t know why, everyone says that touched events are bad for hitbox so I tried use the hitbox module but I will need a insane amount of attachements for it work, maybe it will even lag because of that.
This is a video of the attack (sorry for the low fps, the framerate was already bad and after convert to mp4 it got even worse):
if it’s necessary here’s the script (I made everything on a local script because is a test)
local tool = script.Parent
local Player = game:GetService("Players").LocalPlayer
local Char = Player.Character
local hum = Char:FindFirstChild("Humanoid")
local Humrp = Char:FindFirstChild("HumanoidRootPart")
local Notequipped = true
local Mouse = Player:GetMouse()
local Cas = game:GetService("ContextActionService")
local RunService = game:GetService("RunService")
local cooldown = false
tool.Equipped:Connect(function()
Notequipped = false
end)
tool.Unequipped:Connect(function()
Notequipped = true
end)
function Attack12()
if cooldown == true then return end
cooldown = true
Player:SetAttribute("AttackMode", "nothing")
local event local db1 = false local db2 = false local anim = nil local db3 = false
local GC = game:GetService("ReplicatedStorage").GravityCharge
local GCC = GC:Clone()
local rh = GC.RightHand:Clone()
local lh = GC.LeftHand:Clone()
print(0)
event = RunService.Stepped:Connect(function()
local Attreq = Player:GetAttribute("AttackMode")
if Attreq == "nothing" then
hum.AutoRotate = false
Humrp.Anchored = true
if not db2 then
local An = Instance.new("Animation")
An.Parent = hum
An.Name = "charge"
An.AnimationId = "rbxassetid://11205382678"
local Animator = hum:FindFirstChild("Animator")
anim = Animator:LoadAnimation(An)
anim:Play() An:Destroy()
db2 = true end
if not db3 then
db3 = true
rh.Parent = Char:FindFirstChild("RightHand")
lh.Parent = Char:FindFirstChild("LeftHand")
rh.f1:Emit(7)
rh.f2:Emit(7)
lh.ParticleEmitter:Emit(3)
end
local MoseC = Mouse.Hit.Position
Humrp.CFrame = CFrame.new(Humrp.Position,Vector3.new(MoseC.X,MoseC.Y,MoseC.Z))
Mouse.Button1Down:Connect(function()
Player:SetAttribute("AttackMode","Preparing")
db2 = false
anim:Stop()
end)
elseif Attreq == "Preparing" and db1 == false then
local conex
db1 = true
conex = Mouse.Button1Up:Connect(function()
conex:Disconnect()
db1 = false
db3 = false
db2 = false
event:Disconnect()
local Ga1 = game:GetService("ReplicatedStorage").GravityAttaq1:Clone()
local range = 30
Ga1.Parent = workspace
if (Mouse.Hit.Position-Humrp.Position).Magnitude > range then
local click = Humrp.Position + (Mouse.Hit.Position - Humrp.Position).Unit * range
Ga1.Position = click
else Ga1.Position = Mouse.Hit.Position end
local x = 1
local function as()
local An2 = Instance.new("Animation")
An2.Parent = hum
An2.Name = "Attack"
An2.AnimationId = "rbxassetid://11215754263"
local Animator = hum:FindFirstChild("Animator")
anim2 = Animator:LoadAnimation(An2)
anim2:Play() An2:Destroy()
end
as()
Ga1.Ball.ParticleEmitter:Emit(1)
task.spawn(function()
while x == 1 do
Ga1.Lines.ParticleEmitter:Emit(1)
Ga1.Mid.ParticleEmitter:Emit(4)
task.wait(math.random(0.25,.75)) end end)
Player:SetAttribute("AttackMode", "nothing")
local AttackTime = 2
wait(AttackTime)
lh:Destroy()
rh:Destroy()
anim2:Stop()
x = 2
Ga1:Destroy()
Humrp.Anchored = false
hum.AutoRotate = true
cooldown = false
end)
end
end)
end
local dqada = 1
if dqada == 2 then
print(anim2)
end
Cas:BindAction("Attackk",Attack12,true,Enum.KeyCode.Q)
Is there any module for something like this, or another way to make hitbox?