search/
Start typing to search packages!
package_2
hitbox-plus
By @nsawill1405
Roblox
MirroredHitbox Plus
Hitbox Plus is a Wally-first Roblox community library for spatial query-based hit detection with snapshot-backed lag compensation hooks and built-in hit validation helpers.
Features
HitboxPlus.Server.create(config)for authoritative hit resolutionHitboxPlus.Client.create(config)for client request building, prediction hooks, and debug traces- box, radius, and cast-oriented query support
- snapshot history and rewind lookup for lag compensation
- default validation rules for latency, team checks, max distance, duplicate attacks, cooldowns, and optional line-of-sight
- structured hit/rejection results for gameplay code and debugging
Install
[dependencies]
HitboxPlus = "nsawill1405/hitbox-plus@0.1.0"
Quick Start
local Packages = game:GetService('ReplicatedStorage'):WaitForChild('Packages')
local HitboxPlus = require(Packages:WaitForChild('HitboxPlus'))
local server = HitboxPlus.Server.create({
history = {
retentionSeconds = 0.25,
},
validation = {
maxLatencySeconds = 0.2,
maxDistance = 14,
},
})
server:pushSnapshot({
timestamp = 12.0,
entities = {
{ id = 'enemy-a', position = Vector3.new(4, 0, 0), radius = 2, team = 'Red' },
},
})
local client = HitboxPlus.Client.create({})
local request = client:buildRequest({
attackId = 'slash-1',
attackerId = 'player-a',
attackerPosition = Vector3.new(0, 0, 0),
attackerTeam = 'Blue',
query = {
type = 'radius',
position = Vector3.new(0, 0, 0),
radius = 6,
},
})
local result = server:resolve(request)
for _, hit in result.hits do
print('accepted', hit.id)
end
Config Notes
history.retentionSeconds: how long snapshots remain available for rewind lookupvalidation.maxLatencySeconds: rejects requests that arrive too far past their client timestampvalidation.maxDistance: caps how far away accepted targets can be from the attackervalidation.allowFriendlyFire: allows same-team hits when set totruevalidation.duplicateWindowSeconds: rejects repeatedattackIdvalues inside the configured windowvalidation.targetCooldownSeconds: rejects rapid repeat hits on the same target for the same attackervalidation.lineOfSight: checkssnapshot.occludersagainst the attacker-to-target segment
Extending
- Replace query backends by passing
queryBackends = { box = fn, radius = fn, cast = fn }intoHitboxPlus.Server.create. - Replace history storage by passing
historyStoreintoHitboxPlus.Server.create. - Replace the default validator state machine by passing
validatorsintoHitboxPlus.Server.create. - Supply
predictorordebug.sinkinHitboxPlus.Client.createfor client-side hooks.
Studio Sandbox
examples/SandboxServer.luauis the source of truth for the server sandbox flow, including sandbox dummy setup, one auto-run attack, and theTriggerAttackretrigger path.examples/SandboxClient.luauis the source of truth for local debug rendering and theFkey retrigger input.- The Studio mirror should install those scripts at
game.ServerScriptService.HitboxPlusSandboxandgame.StarterPlayer.StarterPlayerScripts.HitboxPlusClientExample. - The matching remotes live under
game.ReplicatedStorage.HitboxPlusSandboxRemoteswithDebugPayloadandTriggerAttack.
Local Development
aftman install
lune run test/run.luau
stylua src test examples
selene src test examples
Package Details
Install command (Click to copy)
Version
0.1.0
License
MIT
Safe for commercial use
The package archive does not include its license text; the license is declared in its manifest metadata.
Automated license review — not legal advice.
