I am a fairly new to scripting starting about 2.5 weeks ago, so I’m sorry if this post is annoying.
I’ve been trying to make a Sword combat system, so far, I’ve made four different types of simple HitReg systems by using Raycast, Magnitude, OnTouched, and Parts in Region3. Each of these HitReg Systems worked but didn’t reach the product I wanted to get. I wanted to have a HitReg System that actually was the hitbox of the blade, similar to Mordhau’s style of HitReg. So, I looked and eventually found Swordphin123’s Raycast Hitbox Module which I have spent quite a bit of time trying to learn the basics and syntax of.
So I’ve been testing with this script which is suppose to stop the firing of he rays once it hits something.
local Tool = script.Parent
local player = Tool.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
local RaycastHitbox = require(Tool.RaycastHitboxV2)
local NewHitbox = RaycastHitbox:Initialize(Tool)
NewHitbox:DebugMode(true)
function onActivation()
NewHitbox:HitStart()
NewHitbox.OnHit:Connect(function(hit, humanoid)
if hit.Parent.Name ~= character.Name then
humanoid:TakeDamage(10)
NewHitbox:HitStop()
end
end)
end
Tool.Activated:Connect(onActivation)
The rays do stop firing once they hit something, but once they get reactivated, there are “ghost rays” that also do damage. As seen here
I really need some help to understand how to properly utilize this module.