Getting Started:
- Download the resource here.
- Place ClientTween module under ReplicatedStorage.
- Place CT_Initialize local script under StarterPlayer > StarterPlayerScripts.
Require the module:
local tweenClient = require(game:GetService(“ReplicatedStorage”):WaitForChild(“ClientTween”))
Create a tween:
local tween = tweenClient.Create()
Play / Pause / Cancel / Reset a tween:
tween:Play()
tween:Pause()
tween:Cancel()
tween:Reset() – Not a ROBLOX original method
Methods of a tween are the same as ROBLOX’s tween methods, except for the :Reset()
method.
:Reset()
works like :Cancel()
except it will revert the instance’s properties to how they were before tweening.
Pass a player or table of players to any method of a tween to specify clients, passing nil works on all clients:
tween:Play(game.Players.Player1) -- Single player
tween:Cancel({game.Players.Player1, game.Players.Player2}) -- Table of players
tween:Pause() -- Works on all clients
Use the .Completed()
method which fires when a tween finished successfully or is paused with :Pause()
.
tween.Completed:Wait() -- Want to wait until a tween completes?
tween.Completed:Connect(function()
-- Want to run some code when a tween completes?
end)
It is as simple as that, hope you find this useful!