I’m not that familiar with the VSCode + Rojo stack so I’m not entirely sure how Wally works, I will once I figure it out.
I have one more question about this module: will hitbox alternatives be added in the future, such as Shapecasting or Raycasting, by chance?
Hello im new to this module script but when i use HitSomeone its doesnt do anything but if i use HitObject Instead its work fine . Here the code :
local ModuleScript = game:GetService("ReplicatedStorage")["Module Script"]
local HitboxClass = require(ModuleScript.HitboxClass)
local HitboxTypes = require(ModuleScript.HitboxClass.Types)
local HitPart = script.Parent
local hitboxParams = {
SizeOrPart = HitPart.Size,
DebounceTime = 1,
Debug = true,
InitialPosition = HitPart.CFrame,
-- Optionally, you can add Blacklist here
Blacklist = {},
} :: HitboxTypes.HitboxParams
local newHitbox = HitboxClass.new(hitboxParams)
newHitbox.HitSomeone:Connect(function(hitChars)
print(hitChars)
end)
newHitbox:Start()
No, probably not. There are other modules that are good at those already.
Make sure the character you’re trying to hit is in the Alive folder set in the settings. Object mode checks everything except the Projectiles folder, while Humanoid mode, the default, only checks in the Alive folder.
I did add players character to alive folder when players join but it still not working
same here! i’ve found out that my game has been getting memory leaks, just to found out that the part object is removed with the :Remove() function which actually makes it float somewhere without a parent while staying in the memory, i switched that to :Destroy(), the performance got a lil better but i’ll probably have to clear the array…
Are you spawning scripts to do hitboxes and then deleting the scripts themselves?
The part should be getting destroyed when the Hitbox is destroyed as well. I use Remove just to parent the part to nil out of habit for later usage.
Hello! I’m trying to learn how to use HitboxClass, and I’m running into an issue with the Debug property. My hitbox doesn’t show up at all even when Debug is set to true.
-- A ModuleScript required client-side
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local WCS = require(ReplicatedStorage.CombatFramework.wcs)
local HitboxClass = require(ReplicatedStorage.HitboxClass)
local HitboxTypes = require(ReplicatedStorage.HitboxClass.Types)
local KickboxingPunch = WCS.RegisterSkill("KickboxingPunch")
function KickboxingPunch:OnStartServer(player : Player)
local characterModel = player.Character
local humanoidRootPart : BasePart = characterModel:WaitForChild("HumanoidRootPart")
local hitboxParams = {
SizeOrPart = ReplicatedStorage:WaitForChild("KickboxingHitbox"),
DebounceTime = 1,
Debug = true,
Blacklist = {characterModel}
} :: HitboxTypes.HitboxParams
print("Hi, attack just started!")
local newHitbox, connected = HitboxClass.new(hitboxParams)
newHitbox:WeldTo(humanoidRootPart, CFrame.new(humanoidRootPart.CFrame.LookVector * 2.5))
newHitbox.HitSomeone:Connect(function(hitModels)
print(hitModels)
end)
newHitbox:Start()
end
return KickboxingPunch
Hiya, I’m trying to properly understand this but I’m not entirely sure.
From what I see, client side hitbox is still called for the server, doesn’t this mean that the delay will exist nonetheless for higher ping players.
I’m not understanding if HitboxClass.new() can be run on client.
What does the KickboxingHitbox look like? If you recreate it with a Vector3 or a number does it still not show it?
The delay will always exist for higher-ping players, there’s no avoiding that. Best you can do is connect to the client-sided hitbox’s signals to apply VFX and sounds for a more responsive experience.
It can be ran on the client as long as it’s been required at least once on the server.
My hitbox doesnt follow a projectile i made that using bodyvelocity to fling. It hits the ground before the projectile does. It’s basically a grenade
Make sure you use the :Weld() method to weld it to the projectile, and make sure you’re welding it to a part of the projectile that is constantly on it, like the body of a missle.
Just tried Vector3 and number and it still doesn’t show. However, when I connect to its hitSomeone signal, it still prints out whatever it’s hit. KickboxingHitbox is just a cube-shaped hitbox.
Is it possible to make it so that the debug mode visualizer can only be seen by specific players depending on the state of a boolean?
When’s the Next Update for this module
I’m getting the error “Part parameter must be BasePart” on line 467 of HitboxClass. Any idea what this is or how to fix it? It’s spamming my ouput. Thanks!
Just wanted to say thanks for releasing this module. I’ve been using it and it’s great to work with
I am trying to use this module and am encounter a weird situation using the :WeldTo()
function as well as the :SetPosition()
. I have a hitbox welded onto a part which is being moved by an AlignPosition instance to follow the player’s mouse. The part moves perfectly and in most cases the hitbox that is attached to it follows without problem. In some cases, the hitbox seems to get stuck randomly and no long updates its position. The hit event and all that still remains functioning though. It does not matter if the hitbox is welded or if I just spam :SetPosition()
to make it follow. Once it gets stuck, it wont move anymore.
This is my code. At the top I make the part that moves. This all works and the part moves fine. Just the hitbox getting stuck and suddenly forgetting it has to update its position.
If anyone knows what I may have done wrong in my code or if this is a bug with the module, let me know please.
-- Clone the invisible physics part
local part = LightRayPhysicsPart:Clone()
self.part = part
local uuidName = HttpService:GenerateGUID(false)
part.Name = uuidName
-- Move to mouseCFrame
part.Position = mouseCFrame.Position
-- Also set align position's position
part.AlignPosition.Position = mouseCFrame.Position
part.Parent = workspace.Debris
-- Create the vfx and play for all players
local vfx = LightRayVFX.new(uuidName) -- Pass part to weld to
vfx:Start(game.Players:GetPlayers())
self.vfx = vfx
-- Create hitbox params
local hitboxParams = {
SizeOrPart = 4,
DebounceTime = TIME_PER_HIT,
Debug = true,
SpatialOption = "InRadius",
InitialPosition = mouseCFrame,
Blacklist = {character},
} :: HitboxTypes.HitboxParams
-- Create new hitbox with above params
local newHitbox, connected = HitboxClass.new(hitboxParams)
-- Make damage container
local damageContainer = self:CreateDamageContainer(DAMAGE_PER_HIT)
damageContainer.Knockback = {}
damageContainer.Knockback.SourceVector = {mouseCFrame.Position, SOURCE_POWER}
newHitbox.HitSomeone:Connect(function(hitCharacters:{Model})
for _,hitChar in hitCharacters do
-- Get WCS character instance
local hitWCS_Char = WCS.Character.GetCharacterFromInstance(hitChar)
if hitWCS_Char then
-- Apply damage
hitWCS_Char:TakeDamage(damageContainer)
-- Apply burn status effect
BurnEffect.new(hitWCS_Char, FIRE_DAMAGE):Start(FIRE_DURATION_PER_HIT)
end
end
end)
newHitbox:Start()
self.hitbox = newHitbox
-- Weld hitbox to physics part
newHitbox:WeldTo(part)
-- Start loop of updating the mouseCFrame and the physics part
self.thread = task.spawn(function()
while task.wait(UPDATE_TIME) do
-- Get new mouseCFrame
mouseCFrame = getMouse()
if mouseCFrame then
-- Update the physics part position vector
if part then
part.AlignPosition.Position = Vector3.new(mouseCFrame.X, part.AlignPosition.Position.Y, mouseCFrame.Z)
end
end
end
end)