TweenPlus | A Module For Improved TweenService Readability

TweenPlus

Download to File (15.6 KB) | Marketplace | GitHub Documentation

TweenPlus is intended to reduce the TweenService boilerplate and syntax readability/workflow by introducing chainable calls, presets, batch cancellation, and built-in debug signals with zero external dependencies. This is documented in detail in the Github repository linked above.


Quick Documentation

Overview
  • Chainable API: :Then(), :Wait(), :Loop()
  • Presets: :CreatePreset() & :ApplyPreset()
  • Batch cancellation: by tag (:CancelByTag()) or instance (:CancelByInstance())
  • Optional signals: assign OnStart, OnComplete, OnCancel on any handle
  • Debug helpers: .Debug() enqueues timestamped prints
  • Memory-safe: automatic disconnects; zero external dependencies
API

Module Methods (TweenPlus)

Method Description
:Create(inst, info, goals) One-off tween; returns a TweenHandle
:CreatePreset(name, info, goals) Register reusable tween presets
:ApplyPreset(name, instance) Build a handle from a named preset
:CancelByTag(tag) Cancel all tweens with the given tag
:CancelByInstance(inst) Cancel all tweens on that instance
:Debug(message) Print immediately (build-time helper)

Handle Methods (TweenHandle)

Method Description
:Play() Start the tween
:Then(funcOrHandle) Chain another function or handle
:Wait(seconds) Insert a delay
:Loop(count | "infinite") Repeat the chain
:Cancel() Stop and clean up
:Tag(name) Label for batch cancellation
:Debug(message) Enqueue a timestamped print

Optional Signals (assign before :Play()):

handle.OnStart    = function(self) print("[>] started:",    self._tag) end
handle.OnComplete = function(self) print("[✓] complete:",   self._tag) end
handle.OnCancel   = function(self) print("[✗] cancelled:",  self._tag) end
Usage Example
local TweenPlus = require(game.ReplicatedStorage.TweenPlus)
local part = workspace.Part

-- Define & reuse presets
TweenPlus:CreatePreset("In",
  TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
  { Position = part.Position + Vector3.new(0,5,0) }
)
TweenPlus:CreatePreset("Out",
  TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
  { Position = part.Position }
)

-- Build a looping slide
local h = TweenPlus
  :ApplyPreset("In", part)
  :Tag("SlideLoop")
  :Debug("At top")
  :Wait(0.2)
  :Then(function(resume)
      TweenPlus:ApplyPreset("Out", part)
        :Then(resume)
        :Play()
    end)
  :Debug("At bottom")
  :Wait(0.2)
  :Loop("infinite")

-- Optional signals
h.OnStart    = function() print("▶ Slide started")      end
h.OnComplete = function() print("✓ Cycle complete")     end
h.OnCancel   = function() print("✗ Cancelled")           end

-- Play & auto-cancel after 6s
task.wait(1)
h:Play()
task.delay(6, function() TweenPlus:CancelByTag("SlideLoop") end)

Let me know if you find bugs or have feature ideas, this is my first Roblox dev tool!

1 Like