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!