Raycast Hitbox 4.01: For all your melee needs!

How is the module limited ?? I don’t see how really.

What happens if i just repeat HitStart() again without calling HitStop()?
It appears that it just restarts the hit detection but im unsure about what the backend looks like or if this causes a performance issue.

Hi, I’ve been attempting to use this Hitbox module for my games combat system however ive encountered a bug. The first chain of Slashes i do when i Join the game just do not work however the second chain of slashes functions perfectly fine no errors nothing im really confused as to why this is occurring

As for the code:

		Params.FilterDescendantsInstances = {Char}
		Params.FilterType = Enum.RaycastFilterType.Exclude
	local	Hitbox = RaycastHitbox.new(Tool)
		Hitbox.DetectionMode = RaycastHitbox.DetectionMode.Default
		Hitbox.RaycastParams = Params

--different part in the code
	local Hitbox = RaycastHitbox:GetHitbox(Tool)
		if Hitbox then
1 Like

When you playtest in Studio, it uncaches all the animations in your game so they have to load in again. The first time you play an animation its going to be off/delayed. If your attack timings are based on the animation, then thats the reason

Why does this happens? The hitbox is far from the dummy but it’s hitting it anyway, how may i fix it?

(Also here’s the code that activates hitbox raycast)

    -- Hitbox casting

    local cast_params = RaycastParams.new()
    cast_params.FilterDescendantsInstances = {local_plr.Character}
    self.MeleeHitbox.RaycastParams = cast_params

    self.MeleeHitbox.OnHit:Connect(function(hit_part, hit_humanoid, raycast_result, group_name)
        WeaponService:MeleeHit(hit_humanoid, attack_name, sequence_i)

        -- Test part
        local p = Instance.new("Part")
        p.CanCollide = false
        p.Parent = workspace
        p.Anchored = true
        p.Size = Vector3.new(0.5, 0.5, 0.5)
        p.Position = raycast_result.Position

is it better to have this on the server or client?
I’ve heard that this module is very heavy on the server because of how many rays it fires
but also detecting on the client is untrustworthy

Do i raycast on server or client because client seems like it could lead to exploits but this many rays on a server seems bad

Also is it better to make artificial attactments or create them one by one? or what purpose would each have

CC: @OtherAccountJasonB
Yes, it needs to be on the client. Very performance heavy on the server.

You’d only have it on the server if the NPC had the weapon.

I have this code for example:

local tool = script.Parent

local RaycastHitbox = require(game.Replicated.Storage.RaycastHitboxV4)
local Hitbox = RaycastHitbox.new(tool.Handle)
Hitbox.Visualizer = true

But when I reset character and re-equip the tool, I get this error:
Attempt to index nil with "Visualizer"

How do I fix this?

Makes sense. Do you have any reccomendation for anticheat? I just have 1 which calculates distance from the player to the hit, and if the distance is bigger than a number i put in, it returns a bool. Any other things i can do?

There’s no specific anti cheat that suits everyone’s needs. I recommend making your own, which could be as simple as a cooldown checker and a distance checker.

1 Like

Is this module obsolete with the introduction of ShapeCasts?

No, as shapecasts don’t go through all 6 sides of a cube.

yooo this is the best raycast ive ever seen fr

I’m not sure what you mean sorry. Why would shapecasting not go through all 6 sides of a cube?

It has a direction parameter, just like raycasts.

Yes, and this module uses Raycasts. If you are using Raycast Hitbox for punching in your game, you need to add an attachment to each corner of the player’s hand and perform a raycast every frame for each of these attachments (this is what the module does). If you switch to shapecasts, you can perform one shapecast/frame in the size of the player’s hand. This is more performant and easier to scale.

1 Like

Is there any use for OnUpdate?

Is there a way for me to use this module without a tool? maybe its listed somewhere on this forum but there is almost 1000 comments

Im trying to make a punch system using this module but I dont know if its possible or not