Hitbox
The main Hitbox class returned by Module.newHitbox(Fields).
Module.newHitbox(Fields: {string: any})
local hitbox = Module.newHitbox({
Attachment = attachment or nil,
Shape = ("Box" or "Sphere") or "Box",
Position = Vector3 or Vector3.new(0, 0, 0),
Debounce = number or 5,
Pierce = number or 1,
LifeTime = number or 1,
Orientation = Vector3 or nil,
CopyCFrame = BasePart or nil,
CopyCFrameProperties = {CFrame = boolean?, Position = boolean?, Size = boolean?, Orientation = boolean?} or {CFrame = true, Size = true}
Radius = number or 3,
Size = Vector3 or Vector3.new(3, 3, 3),
FilterType = Enum.RaycastFilterType or Enum.RaycastFilterType.Exclude,
FilterDescendantsInstances = {Instance} or {},
RespectCanCollide = boolean or false,
MaxParts = number or 0
}) -> Hitbox
Public
Hitbox.ShapeEnum
Hitbox.ShapeEnum -- {string: string}
enum.Shape. Includes ShapeEnum.Box and ShapeEnum.Sphere.
Hitbox.ModeEnum
Hitbox.ModeEnum -- {string: string}
enum.HitboxMode. Includes ModeEnum.None, ModeEnum.Attachment, ModeEnum.Linear, ModeEnum.Bezier, ModeEnum.Orientation and ModeEnum.Copying
Hitbox.StateEnum
Hitbox.StateEnum -- {string: string}
enum.StateEnum. Includes StateEnum.Paused, StateEnum.Active and StateEnum.Dead.
Hitbox.ConstructionEnum
Hitbox.ConstructionEnum -- {string: string}
enum.ConstructionMode. Includes ConstructionEnum.None, ConstructionEnum.Linear and ConstructionEnum.Bezier.
Hitbox.BezierEnum
Hitbox.BezierEnum -- {string: string}
enum.BezierMode. Includes BezierEnum.Quadratic and BezierEnum.Cubic.
Hitbox.Serial
Hitbox.Serial -- number
Hitbox.Shape
Hitbox.Shape -- string
Box or Sphere.
Hitbox.Position
Hitbox.Position -- Vector3
Hitbox.Pierce
Hitbox.Pierce -- number
Hitbox.Debounce
Hitbox.Debounce -- number
Hitbox.LifeTime
Hitbox.LifeTime -- number
Hitbox.Orientation
Hitbox.Orientation -- Vector3
Hitbox.CopyCFrame
Hitbox.CopyCFrame -- BasePart
Hitbox.Shape
Hitbox.CopyCFrameProperties
Hitbox.CopyCFrameProperties -- {CFrame = boolean, Size = boolean, Position = boolean, Orientation = boolean}
Hitbox.OverlapParams
Hitbox.OverlapParams -- OverlapParams
OverlapParams that's used for spatial query.
Hitbox.Active
Hitbox.Active -- boolean
Hitbox:Activate() and Hitbox:Deactivate() instead.
Hitbox.Radius
Hitbox.Radius -- number
Hitbox.Shape is Sphere. Note: CopyCFrame overrides this property.
Hitbox.Size
Hitbox.Size -- Vector3
Hitbox.Shape is Box. Note: CopyCFrame overrides this property.
Hitbox.Trajectory
Hitbox.Trajectory -- Trajectory
Hitbox.Hit
Hitbox.Hit -- ScriptSignal
Hitbox.Hit:Connect(function(Humanoid, HitPart, HitboxDataBundle)
...
end)
Hitbox.PartEntered
Hitbox.PartEntered -- ScriptSignal
Hitbox.PartEntered:Connect(function(BasePart)
...
end)
Hitbox.PartLeft
Hitbox.PartLeft
Hitbox.PartLeft:Connect(function(BasePart)
...
end)
Hitbox:Activate()
Hitbox:Activate()
Hitbox:Deactivate()
Hitbox:Deactivate()
Hitbox:AddIgnore(object: Instance)
local success = Hitbox:AddIgnore(game.Players.Player1.Character) -> boolean
object to FilterDescendentsInstances table of OverlapParams. Returns boolean Success.
Hitbox:RemoveIgnore(object: Instance)
local numOfItemsRemoved = Hitbox:RemoveIgnore(game.Players.Player1.Character) -> number
object from FilterDescendentsInstances table of OverlapParams. Returns number NumberOfItemsRemoved. **Note: The returned number is 0 on an unsuccessful remove, 1 or more on a successful remove.
Hitbox:GetVelocity()
local velocity = Hitbox:GetVelocity() -> number
Hitbox:SetVelocity()
Hitbox:SetVelocity(velocity: number)
velocity.
Hitbox:ChangeAttachment(attachment: Attachment?)
Hitbox:ChangeAttachment(attachment)
attachment. If attachment is nil, remove Attachment from Hitbox.
Hitbox:IsHitboxBackstab(Part: BasePart, DataBundle: HitboxDataBundle, Margin: number?)
local isBackstab = Hitbox:IsHitboxBackstab(HitPart, HitboxDataBundle, 0.2) -> boolean
Hitbox:IsBackstab(Part: BasePart, Character: Model, Margin: number?)
local isBackstab = Hitbox:IsBackstab(Part, Character, 0.4) -> boolean
Character backstabs Part. Returns boolean. Margin is an optional number ranging from 0 to 0.5, which determines how lenient the backstab detection is. 0.5 would allow for side-stabs to count as backstabs while 0.1 would require basically perfect alignment. Defaults to 0.32. Note: The detection position originates from the provided character's root. Recommended to use this over Hitbox:IsHitboxBackstab() if used in tools of a character.
Hitbox:GetCurrentSerial()
local highestSerial = Hitbox:GetCurrentSerial() -> number
Hitbox:GetConstructionMode()
local mode = Hitbox:GetConstructionMode() -> string
Hitbox:GetCurrentMode()
local mode = Hitbox:GetCurrentMode() -> string
Hitbox.ModeEnum.
Hitbox:Visualize()
local part = Hitbox:Visualize() -> BasePart or nil
Hitbox:Unvisualize(doNotWarn: boolean?)
Hitbox:Unvisualize()
doNotWarn isn't true and the Hitbox wasn't visualizing.
Hitbox:Destroy()
Hitbox:Destroy()
Private
Note: Private variables, methods and functions should not be used unless you know what you're doing.
Hitbox._Attachment
Hitbox._Attachment -- Attachment or nil
Hitbox:ChangeAttachment(attachment) instead.
Hitbox._CurrentFrame
Hitbox._CurrentFrame -- number
Hitbox._CanWarn
Hitbox._CanWarn -- boolean
Hitbox._Visual
Hitbox._Visual -- BasePart
Hitbox:Visualize() and Hitbox:Unvisualize() instead.
Hitbox._Destroying
Hitbox._Destroying -- boolean
true.
The main enum is intended to be completely private. You are not meant to access it.