DebugMode has been changed since 2.0. The new variant is initializing a hitbox first and then calling DebugMode on that. This ensures that you can turn on/off debug rays for specific hitboxes instead of universally enabling it on all of them.
local HitboxMod = require(game.ReplicatedStorage.Modules.RaycastHitbox)
local MY_HITBOX = HitboxMod:Initialize(SwordExample, {Character})
local Debug = false
script.Parent.TextButton.MouseButton1Click:Connect(function()
if Debug == false then
Debug = true
script.Parent.TextButton.Text = "Debug: On"
MY_HITBOX:DebugMode(true)
elseif Debug == true then
Debug = false
script.Parent.TextButton.Text = "Debug: Off"
MY_HITBOX:DebugMode(false)
end
end)
However, if you are still using V1.0+, it should still work the way you are doing.
The lazy approach could be to weld invisible proxy parts to the characterās hands and the attachments would be in those parts. If you want to use the raw limbs of the character to set up raycast points, youāll need to do a bit of heavy lifting by instancing them where you want them and destroying them later when they are no longer needed.
Raycasting is only for parts so it canāt detect Humanoids. The module should take care of this for you automatically though by passing both the part(s) it came into contact with as well as the Humanoid itself.
You should provide more details so that the OP is able to understand what exactly you mean: vague responses usually arenāt helpful. Why are you suggesting that it could use better optimisation and how are your hitboxes not working? Are you able to show a screenshot of your model or otherwise?
I havenāt had much optimisation issues while using this myself.
I had the same problem when i was making stands, For some players the attachments move correctly, But for me they stayed in place like your gif is showing, Iām not quite sure why.
I have looked at a similar stand problem and it seems to be a roblox problem. If the stand is created serversided, parented to player or has physic ownership to the player, and this module is being ran serversided, it exhibits the problems you are seeing.
If you are testing in roblox studio, switch over to the server view from client, the stand will actually have its animations not replicated correctly. There is no easy fix other than to make stand entirely clientsided or making the stands physic ownership server. The attachment positions unaligned are not the module fault.
Hey for some reason whenever I call on the Deinitialize method it returns nil. Both the HitBox and the Weapon exist, so Iām not sure whatās causing the issue here.
Code:
if character:FindFirstChild('Weapon') and HitBox then
HitBox:Deinitialize(character.Weapon);
return true;
end
return false;
Yeah, itās still throwing up a bunch of errors, this time in the module itself. If I donāt deinitialize it, will the module itself deinitialize if I remove the object itself? Cos if so I wonāt need to worry about manually deinitializing it.
It would be helpful if you stated what errors showed up in the module. As far as I know, it works for me.
Deleting the actual instance that you initialized with should auto clean up the hitbox, though this is a very expensive operation if you are doing it constantly.
Those are the errors itās giving me. My code is the same as before except Iāve switched it to use RaycastModule:Deinitialize(Object). It happens whether I call it before destroying the object, or if I call it without destroying the object.
Hmm, did you deinitialize it already? The output message āhitbox object awaiting deletionā suggests it is on its way to be garbage collected and no longer usable. The only thing I can probably think of is you deinitialized already but tried deinitializing again when the instance was nil.
Any idea why, despite the fact that I have two character models in the exact same position, they donāt get hit at the same time? Currently Iām only running HitStart() and nothing else. One player gets hit, the rays seem to ignore the second player for a few moments, and then the second player gets hit. Is there a solution to this?
Do you have a video of the problem? If the rays are already inside a target, it will not register it (rays only register hits going inside a part, but canāt register a hit if the rays are coming out of the part). I advise developers to implement their hit detection on the client side to prevent any weird server delays as well.