Pulse.Hitbox
Pulse.Hitbox solves one specific problem: you want to temporarily resize a part (typically a hitbox), and you want to restore it cleanly when done — even if the script is re-injected.
The problem it solves
Without Pulse.Hitbox, a typical approach looks like:
-- Save original size manually
originalSize = part.Size
-- Expand
part.Size = Vector3.new(30, 30, 30)
-- Later, restore
part.Size = originalSize
This breaks when: the part is nil at restore time, the script is destroyed mid-change and not restored, or multiple features try to resize the same part.
API
local hm = Pulse.Hitbox.new("uniqueKey")
hm:apply(part, size) -- save original (as attribute) and resize
hm:restore(part) -- restore to saved size
hm:restoreAll() -- restore every part this manager has touched
sizeis a number — the part becomesVector3.new(size, size, size)(a cube)- The original size is saved as a Roblox attribute on the part (
OriginalSize), so it survives script re-runs
When to call restoreAll
Always call hm:restoreAll() when the feature is disabled:
local function run(value)
if value then
_loop:start()
else
_loop:stop()
_hm:restoreAll() -- ← important
end
end
on sizeEnabled { run(v) }
Using multiple managers
If different features resize the same part, they'll conflict. Give each feature its own manager with a unique key and be careful about the order of apply/restore.
In practice, it's better to have one component own hitbox resizing for a given set of parts and let others read the current state rather than resize independently.
Limitations
apply(part, size)only supports uniform cube resizing. Non-uniform resizing needs directpart.Sizeassignment.- If
partis destroyed betweenapplyandrestore,restoreAllsilently skips it (pcall-wrapped). - Multiple features resizing the same part will overwrite each other. Coordinate through a single component.