Raycast Hitbox 4.01: For all your melee needs!

sorry, I should have been more specific. Activate the hitbox from the client then send the hit data to the server

1 Like

Will the exploiter use hitbox extender >:(

1 Like

i may be answering my own question by why not play the animation in a serverscript and make a local variable that becomes a connection instead of making it play on both local and serverscripts?

Its hard to do this, because you need to adjust the attachments position. You could add a check, and if the attachment has moved, kick the player or even move it back. You would have to do this with Position And NOT world position

I don’t think this would work. But even if it did, you would still have the problem with client delays. To sum it up try swinging while the player is walking, then you will see that the hitbox is far behind

This is similar to ClientCast:
ClientCast - A Client-based, Idiosyncratic Hitbox System! - Resources / Community Resources - DevForum | Roblox

Edit: I don’t believe Raycast Hitbox would replicate from client only ClientCast does

I have done this to the weapons in my game as well, It works perfectly fine.

Edit: I only realised what you meant about the exploiter prevention, didn’t even know that ClientCast was a thing until you showed me it. Thanks

2 Likes

ClientCast has easier exploiter prevention if you set the ClientCaster’s owner to a client

Example:

Caster.Collided:Connect(function(Data)
    if (Data.Position - Caster.Object.Position).Magnitude > 5 then
        return print("very likely an exploiter")
    end
end)

Ah, I see, so i make the hitbox on the client, and then when the animation has reached the keyframe i do onclientevent and then start the hitbox?

yo whats the difference between clientCast and this hit box system?

here’s what the previous post said:

Adding onto this, you should also verify Data.Instance itself - exploiters can decide to keep Data.Position the same, but spoof Data.Instance.

1 Like

Oh, I didn’t know you were waiting upon a keyframe, I haven’t tried this but this might be the issue. Personally the way I would do it and have did it in the video is when the tool is activated, wait a certain amount of time then Start the hitbox. Here is a scuffed example but you get the point.

That could be true, but making a anti cheat for this shouldn’t be to hard either. I just did this for 1 Attachment but doing this for all of them shouldn’t be any different.

image

I just finished this script in a few seconds so its not to complicated.

1 Like

Ohh ok thanks i needed that info

1 Like

Does this work with non-player characters? I’m creating a hitbox for my own character, and it works fine, but it’s not working when I create a hitbox for an NPC character. I’m using the same exact code for both.

local function HandleHitbox(Params, Player)
	warn("CREATING HITBOX")
	local Character
	
	if Player then
		Character = Player.Character
	else
		Character = Params.Character
	end
	
	if Params.Status == "Connect" then
		warn("Connecting")

		local Tool = Character:FindFirstChildOfClass("Tool") or Params.Tool
		local CombatInfo = Tool:WaitForChild("CombatInfo")	
		
		warn("Found tool: " .. Tool:GetFullName())
		
		local Hitbox = RaycastHitbox.new(Tool)
		Hitbox.DetectionMode = RaycastHitbox.DetectionMode.PartMode
		Hitbox.Visualizer = false	
		Hitbox.OnHit:Connect(function(Hit)
			HandleHit(Hit, Tool)
		end)

I have verified that the function still runs for the NPC and that its tool is found.

Output for my character:
17:29:12.759 Connecting
17:29:12.759 Found tool: Workspace.kvKAVl.7000
17:29:12.759 created hitbox for: kvKAVl

Output for NPC:
17:29:20.193 Connecting
17:29:20.194 Found tool: Workspace.Dummy.7000
17:29:20.194 ServerScriptService.Remotes.NewCombat.Hitbox:35: attempt to index nil with ‘DetectionMode’

Any help would be greatly appreciated. :pleading_face:

1 Like

Is that on the client or server? Either way there are other approaches to it like checking if the attachments have moved outside the handle’s hit box and doing a server checking by checking if the position is valid and in close proximity to the handle.

It works from both the server and the client. And yes there are other ways but I just spent 3 - 4 minutes on it so it isn’t perfect.

Hey, I’ve been using this melee module for a while now. I’ve done a lot of modifying to it, such as introducing blocking, hitting more than once, going through players, etc. It’s sort of been a problem, but for some reason, whenever I use the melee system, over time the game gets more and more laggy. The game starts out fine, there aren’t any unions or looping scripts, but after about 5 or 10 minutes, the game becomes very laggy.
This has been a previous issue, as my old raycast melee system wasn’t able to delete rays. Is there anything you can suggest or advise? Rays are produced on the client, btw.

So, what would be better, this raycast hitbox, or using just a region 3 added to the front body torso of the player?