Skip to content

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.

create(instance: Instance, info: TweenInfo, goals: Record<string, number | Vector3 | Vector2 | Color3>): Tween

Animates 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.

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();
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();