TweenService
Animates number, Vector3, Vector2 and Color3 properties smoothly from their current values to new ones.
- Get it:
import { TweenService } from '@rally/sdk'
TweenService.create returns a Tween; call play() on it. A tween runs
on the side that plays it: tweens on the server replicate to every player (about 20 updates a
second, smoothed on their devices); tweens in a LocalScript run only on that device, at full frame
rate.
For motion with several steps (rise, wait, come back), use an Animation instead.
Methods
Section titled “Methods”create
Section titled “create”create(instance: Instance, info: TweenInfo, goals: Record<string, number | Vector3 | Vector2 | Color3>): TweenAnimates numeric, Vector3, Vector2 and Color3 properties. Call .play() on the result.
info is a TweenInfo: time in seconds, plus optional
easing, repeatCount, reverses and delay. goals maps property names to their end values.
Examples
Section titled “Examples”A sliding platform
Section titled “A sliding platform”import { Part, TweenService, Vector3, getChild, workspace } from '@rally/sdk';
const platform = getChild(workspace, 'Platform', Part);TweenService.create( platform, { time: 3, easing: 'sineInOut', reverses: true, repeatCount: -1 }, { position: platform.position.add(new Vector3(20, 0, 0)) },).play();Fade a part out, then remove it
Section titled “Fade a part out, then remove it”import { Part, TweenService, getChild, workspace } from '@rally/sdk';
const wall = getChild(workspace, 'Wall', Part);const fade = TweenService.create(wall, { time: 1.5 }, { transparency: 1 });fade.completed.connect(() => wall.destroy());fade.play();