HitboxClass | v1.1B | A Powerful OOP-based Hitbox Module

My bad for seeing this late, but, I’m not sure. I’m currently debugging my script to make other parts of it to work, I’ll fix the general parts and see if I’m passing the params right.

I’m trying to learn how to use your module but I don’t understand why the code doesn’t work even though I’ve followed all the steps

You don’t have the LookingFor parameter set to “Object”. You’re connecting to the HitObject signal, which doesn’t fire if the LookingFor parameter is not set to “Object”. It’s set to “Humanoid” by default, which fires the HitSomeone signal.

Click here for more info on it.

So in your case, your hitboxparams would look something like this:

self.hitboxParams = {
     SizeOrPart = Vector3.new(10, 10, 10),
     LookingFor = "Object",
     DebounceTime = 1,
     Debug = true
}

I tried HitSomeone but it didn’t work so Imma use HitObject

2 Likes

I tried to use HitSomeone, but it seems like it doesn’t work. I added the script you made earlier into the conversation, but it still doesn’t function (HitObject work perfectly btw).

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HitboxClass = require(ReplicatedStorage.HitboxClass)

local Success = false
local newHitbox, connected

local hitboxParams = {
	SizeOrPart = 5,
	DebounceTime = 1,
} 

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(character)
		local guidePart = Instance.new("Part")
		guidePart.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(0, 0 , -6.9)
		local weld2 = Instance.new("WeldConstraint")
		weld2.Part0 = guidePart
		weld2.Part1 = character.HumanoidRootPart
		weld2.Parent = guidePart -- setting it to the guide part since I don't have VFX
		guidePart.Transparency = 0.5
		guidePart.Size = Vector3.new(4, 5.256, 13.713)
		guidePart.Parent = workspace.Projectiles
		guidePart.Massless = true
		guidePart.Anchored = false
		guidePart.CanCollide = false

		local hitboxParams = {SizeOrPart = guidePart, DebounceTime = 1, Debug = true} :: HitboxTypes.HitboxParams

		local newHitbox, connected = HitboxClass.new(hitboxParams)
		newHitbox:WeldTo(guidePart)
		newHitbox:SetVelocityPrediction(false)

		newHitbox:Start()
		newHitbox.HitSomeone:Connect(function(model)
			print(model)
		end)
		task.wait(3)
		newHitbox:Stop()
		guidePart:Destroy()
	end)
end)

When I test it with your code, it works 100% for me. I’m using the latest version from the Github. Did you edit anything in the script?


Click here if you can’t see it.

yeah i’m using the lastest version but still not working :confused:

here the place (uncopylocked)

Can you show the script of the hitbox working in your fighting game

Nothing is in the Alive folder. Everything is in the workspace. HitboxClass only checks for characters within the alive folder you set it to check.

local Character = script.Parent
Character.Parent = workspace.Alive

A script like this on the character will parent it to the alive folder on spawn. You can put it in StarterCharacterScripts and it’ll be placed on spawn.

This module relies on the fact that you have a folder that all of your living things are inside of. If there’s nothing in it, it won’t ever detect anything.

The fighting game uses an older version of the module, specifically modified for the game, so I can’t really do that. I’ll make a tutorial place at some point when finals are done though. Make sure all your characters you want to check for are in your alive folder, and that everything else is set up correctly according to the Github.

Updated HitboxClass to v1.1A

  • Fixed a large bug where HitboxClass may not replicate properly to people that join a server before it’s initialized. After death, they would no longer respond to the Hitbox objects requesting them to perform calculations.

  • Hitbox objects now properly destroy the HitObject signal before cleanup.

  • Removed the ObjectValue that handles the reference to the HitboxClass module. It now does this automatically.

  • Setting Debug mode to true in the HitboxParams no longer shows the hitbox before it’s been started.

Updating is recommended. This update can just be dropped in with no changes in functionality.

If there’s any bugs, let me know!

The HitSomeone function still won’t work for me for some reason

If you can give me a place to look at I can try and see what’s going on.

Alright great hold on lemme go get it

hitbox thing.rbxl (96.5 KB)

Like I told the previous person, you need to have the things you’re checking for in the Alive folder you set in the settings. In your case it’s the folder “E”. Place the R6 model in there and it’ll work.
da5c1574a64c3df48839d934407bb79a

HitboxClass only checks for things within the Alive folder. If there’s nothing in there, it won’t ever detect anything.

BROO TYSM THIS HELPED ME. Also, Can you put this detail in the documentation and the introduction of this forum

Does this automatically put players in this folder

If not, can you make it so it does that

No, I can’t do that, you have to do that. Whenever you spawn an NPC, place them in the folder, or put something like this in a script in StarterCharacterScripts.

local Character = script.Parent
Character.Parent = workspace.Alive
1 Like