Skip to content

Nirmini/OpenTween

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

OpenTween

OpenTween is a tweening module for Roblox intended to improve visual quality and smoothness while keeping performance in mind. It allows for client-side, server-side, and synchronised tweens across all clients in a single package.

OpenTween handles everything it needs internally — remote events are created and managed automatically, so there's no manual setup required beyond placing the scripts. Tweens can also be paused or cancelled at any time regardless of where they're running.

OpenTween is a fork of AstraTween by AstraX2. AstraTween is an excellent client-sided tweening module and the foundation that OpenTween builds on. OpenTween extends it with server-side execution, client synchronisation, and pause/cancel support.

Setup

Place the ModuleScript in ReplicatedStorage and the LocalScript as a descendant of StarterPlayerScripts. The LocalScript's rootPath variable should point to wherever the ModuleScript is parented — it defaults to game.ReplicatedStorage.

Blocks being tweened via TweenInstance should have Anchored set to true to prevent physics from interfering.

Configuration

The following options are available in the config table at the top of the ModuleScript.

Option Type Default Description
serverIsReplicationPrimary bool true Clients report progress back to the server. Enables pause, cancel, and out-of-sync correction.
explicitServerAnimation bool true Default functions (TweenModel, TweenInstance, TweenInstanceFull) also run the tween on the server's workspace in addition to firing to clients.
syncMargin number 5 Margin of error in seconds before a client is considered out of sync and corrected.
syncCorrectionTime number 0.5 Duration in seconds over which a correction tween is applied to an out-of-sync client. Snaps if the correction tween itself drifts.

Documentation

Namespaces

OpenTween exposes three namespaces. The default namespace respects explicitServerAnimation. OpenTween.Server always runs the tween on the server's workspace. OpenTween.Client never touches the server's workspace and only fires to clients.

All tween calls return a tweenId string that can be used with PauseTween, ResumeTween, and CancelTween.


OpenTween:TweenModel(model, time, style, direction, goalPosition)

OpenTween.Server:TweenModel(...)

OpenTween.Client:TweenModel(...)

Tweens a model using its PrimaryPart as a pivot. PrimaryPart must be set.

Argument Type
model Model
time number
style Enum.EasingStyle or string
direction Enum.EasingDirection or string
goalPosition CFrame, Vector3, BasePart, or UnionOperation

OpenTween:TweenInstance(target, time, style, direction, goalTable)

OpenTween.Server:TweenInstance(...)

OpenTween.Client:TweenInstance(...)

Tweens an instance. Functionally similar to TweenService:Create() with fewer arguments. Use TweenInstanceFull to access repeat, reverse, and delay options.

Argument Type
target Instance
time number
style Enum.EasingStyle or string
direction Enum.EasingDirection or string
goalTable {Property = Value, ...}

OpenTween:TweenInstanceFull(target, time, style, direction, repCount, reverses, delayTime, goalTable)

OpenTween.Server:TweenInstanceFull(...)

OpenTween.Client:TweenInstanceFull(...)

Tweens an instance with full TweenInfo control.

Argument Type
target Instance
time number
style Enum.EasingStyle or string
direction Enum.EasingDirection or string
repCount number (set to -1 for infinite repeats)
reverses boolean
delayTime number
goalTable {Property = Value, ...}

OpenTween:PauseTween(tweenId)

Pauses an active tween on the server and all clients. Requires serverIsReplicationPrimary to be true.

OpenTween:ResumeTween(tweenId)

Resumes a paused tween on the server and all clients.

OpenTween:CancelTween(tweenId)

Cancels an active tween on the server and all clients and removes it from tracking.

About

OpenTween is a custom library created to create tweens in Roblox in a way that's generally easier and more performant. Client-Side tweens are based off of AstraTween by AstraX2.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors