RaycastHitboxV4 detecting hits from far, where it doesn't hit visually

Hello! Recently i’ve been trying to do a weapon system with RaycastHitboxV4, a module created by @Swordphin

Well, the problem here is that the raycasting is hitting targets from far?? Even if it doesn’t visually hits?
Here’s a video for demostration:

(it says in output that it hitted)

I’m using RaycastHitboxV4, as i need to start and stop the casting with timed delays and durations of attacks. Do i have another alternative or solution to this problem? I’ve searched for days for a solution and i can’t seem to find any post that talks about this

Here’s the test place i used:
RaycastHitboxTestPlace.rbxl (103.5 KB)

Well, once again i find my own solution for my own problem.

Anyways, if you ever encounter the same problem i faced, here’s a “module” i scripted that does the work that RaycastHitboxV4 do, but simplier and without the debug visualization feature.

Also, this code is based from ClientCast, a module made by PysephDEV (thank you!), which at the same time is based on RaycastHitboxV4

Finally, i recommend using RaycastHitboxV4 instead of this module. Only use this module in case RaycastHitboxV4 has the same bug i’ve encountered. This module was only designed to be used with Melee Weapons.

MeleeCast.rbxm (2.0 KB)

How to use:

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or Player.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local MeleeCast = require(PATH.MeleeCast) -- Put here the path to MeleeCast

-- Get the part of a melee weapon that has "DmgPoint" attachments inside it. This module works similar to RaycastHitboxV4
local SwordBlade = workspace.Sword.Blade

-- Create new raycast parameters
local CastParams = RaycastParams.new()
CastParams.FilterDescendantsInstances = {Character}

-- Creates a new melee caster, with the WeaponPart and the CastParams
local Caster = MeleeCast.new(WeaponPart, CastParams)

-- You can connect two events, "OnHit" or "OnHumanoidHit". Will not detect more than once part/humanoid, until it stops.
local HitConnection = Caster.OnHit:Connect(function(RaycastResult)
    print("Hit!", RaycastResult)
end)

-- This for humanoids. Will only detect once per time it starts, until it stops.
local HumanoidHitConnection = Caster.OnHumanoidHit:Connect(function(humanoid, RaycastResult)
    print("Humanoid Hit!", Humanoid, RaycastResult)
end)

-----
-- To start or stop casting, just call Caster:Stop() or Caster:Start().
-----

-- While holding Left Mouse Button, it will be casting.
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        Caster:Start()
    end
end)

UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        Caster:Stop()
    end
end)

Hope this is for any help to somebody trying to make a weapon system, where RaycastHitboxV4 can’t be an alternative!

Well, once again i find my own solution for my own problem.

Best way to learn, sorry no one got back to you though, and thanks for sharing your solution with others.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.