Skip to main content

Pulse.Restore

Pulse.Restore saves the current value of an instance property and lets you restore it later — even across multiple calls. Use it when you're modifying instance properties that should go back to their original values when a feature is disabled.


API

local r = Pulse.Restore.new()

r:save(instance, "PropertyName") -- save current value (only saves once per property)
r:one(instance, "PropertyName") -- restore one property to saved value
r:all() -- restore all saved properties

r:has(instance, "PropertyName") -- bool: has this been saved?

Example — modifying walk speed

defineComponent('SpeedMod', () => {
const enabled = signal(false)
const r = Pulse.Restore.new()

function apply() {
const h = _PulseGetHumanoid()
if (!h) return
r.save(h, 'WalkSpeed') // saves the original speed before modifying
h.WalkSpeed = 50
}

function restore() {
r.all() // restores WalkSpeed to original
}

on.signal(enabled, (v) => {
if (v) apply() else restore()
})

on.respawn(() => {
if (enabled()) apply() // new character — re-save and re-apply
})

return [toggle('Speed Mod').bind(enabled)]
})

Limitations

  • save only saves once per (instance, property) pair. Calling it again on an already-saved property does nothing — it won't overwrite the saved value with a modified one.
  • all() sets all saved properties synchronously. Large property sets will block briefly.
  • Properties that no longer exist on the instance (e.g., the humanoid was destroyed) are silently skipped.