Use animation events and in the code just use :GetMarkerReachedSignal("SwingStart")
and :GetMarkerReachedSignal("Recovery")
something like that
also it would be nice if you could keep the destroy alias in the good signal module because i tried to hook the OnHit event to a maid object and it gave me an error just a suggestion though
Hit-Detection not registering on weapon hit
The Hit-Detection doesnât work on players, it takes about 20 hits below before getting hit by the weapon, Iâm not sure how i can fixed this, any help is acceptable. Thanks!
Here is the video, As you can see the Hitbox doesnât detect if the player is hitting the player
Here is the code for Server Sided:
local Tool = script.Parent
local Handle = Tool.Handle
local anim = Tool.SafeBox
local Light = Instance.new(âHighlightâ)
Light.Enabled = false
Light.OutlineTransparency = 1
local RayCast = require(game.ServerScriptService.RaycastHitboxV4)
local HitBox = RayCast.new(Tool.Hitbox)
local de = false
local canhit = false
config = {
Damge = 20,
AttackTime = 0.002,
Cooldown = 0.002,
}
HitBox.OnHit:Connect(function(hit, Humanoid)
if canhit == false then return end
canhit = false
if Humanoid.Parent ~= script.Parent.Parent then
Humanoid:TakeDamage(config.Damge)
local char = Humanoid.Parent
Light.Parent = char
Light.Enabled = true
wait(0.086)
Light.Enabled = false
local Character = Humanoid.Parent
local knockback = Instance.new("BodyVelocity")
knockback.P = math.huge
knockback.Parent = Character:FindFirstChild("HumanoidRootPart")
knockback.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
knockback.Velocity = Character:FindFirstChild("HumanoidRootPart").CFrame.lookVector * -35
game:GetService("Debris"):AddItem(knockback, 0.01)
task.wait(.025)
end
canhit = true
end)
script.Parent.Hit.OnServerEvent:Connect(function(Player)
if de == false then
de = true
wait(0.03)
script:WaitForChild(âSwordSwingâ):Play()
de = false
if de == false then
de = true
local hum = Player.Character.Humanoid
local animlist = anim:GetChildren()
local selected = hum:LoadAnimation(anim.Play1)
selected:Play()
HitBox:HitStart()
wait(0.04)
canhit = true
wait(0.01)
HitBox:HitStop()
canhit = false
de = false
end
end
end)
Client-Sided inside of tool:
local Tool = script.Parent
local Mouse = game.Players.LocalPlayer:GetMouse()
local hit = script.Parent:WaitForChild(âHitâ)
function isEquipped()
if Tool.Parent:FindFirstChild(âHumanoidâ) then
return true else return false
end
end
Mouse.Button1Down:Connect(function()
if not isEquipped() then return end
hit:FireServer()
end)
Remove the period inbetween ReplicatedStorage in the RaycastHitbox variable.
hey hey hey quick question when should i use this on a serverscript and on a clientscript? thank you in advance!!
Is it possible to still get V3? I want V3 to test it out.
- You can use GetDescendants and type checking it if you really want.
- Donât be afraid of using open source code. Itâs there for a reason and the mindset of freemodels/open source code instantly = bad game is not a good mindset to have as a developer.
bro isnt there over 1k parts in the baseplate game by default
you are looping through it every heartbeat?
there are multiple weapons which will run it multiple time?
You can do something like Tool:GetDescendants()⌠You donât have to loop through your entire workspace. If itâs that serious then use CollectionService and :GetTagged()
Hi all! Sorry for not replying to anyone for the past couple of months. Realistically, this module is considered stable so there isnât a need to update anymore.
For the last few years Iâve been playing around with using actors (but the way Roblox implemented actors makes any performance gain from using it not that worth), so if anyone is asking about that, I will not be implementing parallelization any time soon.
In some other news, Iâll be releasing a new module probably dubbed âShapecast Hitboxâ (unless that name got stolen already) sometimes in the near future. Itâll be the successor to this module but will have different features, such as the ability to use Shapecasting (Block, Sphere, or Raycast), Resolution (can adjust to make raycasts less accurate for more performance), and some typechecking capabilities. There will be some features that wonât make it back (like SetPoints, LinkAttachments, Hitbox Distinctions) mainly because I think those arenât needed anymore.
There will also be an optional helper plugin (will most likely be paid to support development of that module further) that allows you to auto-generate attachments in a part, generate block or sphere
shaped raycast colliders which you can move or rotate with studio tools. For people who likes to script the hitboxes in, this is probably not that useful but itâll help people visualize and edit their hitboxes on the fly.
Generally the API is more simplified and generalized (no longer just working for humanoids, etc). It also should be more performant since I found out that V4 is pretty inefficient as it needs to go through all the hitboxes, even the inactive ones.
It probably will look like this:
local hitbox = ShapecastHitbox.new(swordHandle, raycastParams)
-- The hitbox will automatically disable itself after 3 seconds
-- The duration field is optional and will last indefinitely otherwise
local duration = 3
-- HitStart is chainable into OnUpdate. You can alternative use
-- `Hitbox:OnUpdate()` on a new line if you prefer multi-lined usage.
hitbox:HitStart(duration):OnUpdate(function(delta)
-- We hit something!
if hitbox.RaycastResult then
-- HitStop is chainable into OnUpdate or HitStart.
-- For this example, we'll destroy the hitbox right
-- after hitting something.
hitbox:HitStop():Destroy()
end
end)
-- Alternative, we can manually destroy the hitbox at some other time.
task.delay(10, hitbox.Destroy, hitbox)
or can really simplify it and chain it like so:
local hitbox = ShapecastHitbox.new(swordHandle, raycastParams)
:HitStart(duration)
:OnHit(function(raycastResults, segmentHit)
local damage = 20
-- Do more damage if the sword traveled further!
if segmentHit.Distance >= 10 then
damage *= 2
end
raycastResults.Instance.Parent.Humanoid:TakeDamage(damage)
end)
:OnUpdate(function(delta)
--- Can do stuff per frame here
end)
:OnStopped(function()
--- What happens when the hitbox stops?
hitbox:Destroy()
end)
If anyone still reads this thread, do you think you are interested in trying it out when it releases?
Here is the preview of ShapecastHitbox and the new plugin:
The plugin allows you create and modify shapecasts.
So rather spamming a few hundred attachments to get the same shapes, you can just modify the shapes of your hitbox however you like.
absolutely! i love this plugin and will always be my go when it comes to melee weapons. your work is deeply appreciated!
Is there a estimated release date?
I was just about to ask the same thing!
Yes, there are no good shapecast utility modules that I know of, a sequel to Raycast Hitbox 4.0 for shapecasts would undoubtedly be amazing
Shouldnât take longer than two weeks! Probably @ me here again if I miss the deadline, haha! Currently, the module is complete but I am testing it in two full scale production games to ensure that nothing is wrong before I commit to a public release.
And also helps me to give me a window for feedback from testers to see if the API needs to be improved.
EDIT:
For those who wants to try it out earlier with us:
Hereâs the Github link to the module or Wally if you are using Rojo. Be aware that this is very early versions that is currently undergoing tests with our teams.
There are no documentations just yet, but you can take a look at ShapecastHitbox/Types.luau to get a general feel of the API. For those who are new to Github, you can just download the file and copy paste the code into your codebase.
Iâm having an issue where when I start a hitbox, the first set of lines (at least how it appears in the visualiser) doesnât seem to register a hit, but the other lines work fine.
In the âAttachmentsâ module script in the solvers folder on line 15, shouldnât
local origin: Vector3 = point.Instances[1].WorldPosition
actually be
local origin: Vector3 = point.LastPosition
?