Hi, trying to set up a blacklist and I receive the error: Argument 1 missing or nil
When I click to go to the code it appears to be complaining about ‘newHitBox’(see code below) which makes no sense:
local newHitbox = RaycastHitbox.new(Handle.Mesh)
newHitbox.RaycastParams = RaycastParams.new()
newHitbox.RaycastParams.FilterDescendantsInstances = Player
newHitbox.RaycastParams.FilterType = Enum.RaycastFilterType.Blacklist
with out the Params setup the hitbox is created and works.
No, it only works if you are moving. Raycasts requires distance for it to detect hits. The raycasts does not have a set width and therefore equals to zero distance if you are not moving.
Another developer here used the LinkAttachments function here to circumvent that issue since it allows hitboxes even while stationary.
I have placed the hitbox code into my sword script and it is working ok, but is this a good practice? Should I have the definitions for the hit box in another script so it can be assigned as needed to different weapons and just set a call to the needed weapon script in the script that defines the hitbox?
There really isn’t a “proper” way to use this module. It’s designed to be as easy as possible to fit any project of all sizes. This is general advice but if its readable, convenient, and doesn’t hamper debugging, then it should be fine. Ultimately, as you develop your game further, you will learn yourself what is best practice for how to implement it according to your needs.
I had a quick question. Is there support or features that show the vector 3 point or any offset position relative to the parts hit? The reason I ask this is because I’m trying to detect the position one of the raycast attachments comes into contact with an object so I can put a visual effect at that point. Or even if there’s a way I can get the specific attachment, I can find the point using the world position.
I’ve got an issue with the module, the raycasts are not showing up correctly for me, here’s some code and a gif of what’s happening:
local hitbox = Raycast.new(Character)
hitbox.OnHit:Connect(function(hit, humanoid)
if not hit:IsDescendantOf(Character) then
print(hit.Name)
humanoid:TakeDamage(Damage)
end
end)
hitbox:HitStart(5)
Is this on the server? It looks like the server sees the weapon and animation at a different location than the client. See if the server is looking at a different position.
The only thing on the client is a Remote Event doing :FireServer() inside of the ‘Punch’ tool script, the animation and the module are being used on the server.
Since the server is handling this, you should check if the above is the case. Clients will see the animations play accordingly but the server may not have the proper animations replicated. The gif, from what I see, the animation plays on the server but the character does not have the “idle” animation which causes the rays to flatline at the end of the animation.
You should be able to see this by switching to the server view while testing in studio.
On the client, the tool is being held, however, the server doesn’t see the Punch tool being held, so on the server, the rays are accurate, but not on the client.
What should I do exactly?
Edit: Should I make an animation for holding the tool?
Unfortunately, I don’t really have a lot of experience working with tools so it’s hard to come up with a definite solution. Honestly, I think it’s a Roblox bug that the default tool holding animation isn’t coming up on the server.
However, I can give some general insights on some techniques that may help. An idle animation may help since it doesn’t rely on the buggy tool to hold it for you. I would also make the client play the attack/idle animation. Load these animations on the humanoid’s animator, and it should replicate properly to the server with no issues.
Forcefully playing animations on the server, from what I’ve tested, always resulted in weird issues like you experienced.
I have a sitation where a sphere shaped hitbox need to get bigger over time while it travels. Since the attachments will not also move as I tween the sphere, does anyone have any thoughts how this can be done?
It seems in cases like that that .GetTouching might be best, but i was hoping to stick with the raycasting.
Can’t you pre-check the positions of the FINAL attachment positions when the ball is at its max size, And then tween the position of the attachments to the final position with the same time as the ball?
(Not WorldPosition)
EDIT: Actually… This won’t work, Since the attachments will spread more the bigger the ball gets, You could make a ton of attachments so they will all cover enough in the end, But that’ll be a lot of tweening to do…