(UPDATE 12/7/20)
-
Added more features and documentation such as :Destroy() and :Cancel()
-
Cleaned up code for readablility
-
Optimized Code
Hello Developers!
As my first open source script, I made a module that allows you to easily turn a server tween into a client tween! Along with this, this module contains useful extra features that you can toggle. This was made to be easy to use by all skill levels with commented code to be easy to modify.
“What is client tweening and why should I use client tweening over server tweening?”
-
Client tweening is using TweenService on the player’s computer instead of the server to render the motion.
-
Client tweening is visually smooth even on extremely large games
-
Helps take the load of tweening off the server.
“I’m a advanced developer and know how to use client tweening, what use of this is to me?”
-
This module removes the issue of client syncing (Players not seeing the same thing because of ping) through speeding up the tween depending on your ping.
-
Automatically cancel past tweens of the same object if the “CanBeCancelled” setting is enabled.
Get it here!
Easy Server to Client Tween.rbxl (37.6 KB)
Roblox Model
(https://www.roblox.com/library/5044326016/Easy-Server-to-Client-Tween)
Edit: Fixed tick() syncing issue with quenty’s module
“So I have it, but how do I use it?”
(This is also located inside the module).
1: Create a server script, (or edit an existing one)
2: In the script, require the module
local EasyTween = require(rep:WaitForChild("EasyClientTween"))
3: Create the tween handler
local EasyTween = require(rep:WaitForChild("EasyClientTween"))
local tweenHandler = EasyTween.new(Cancellable, InStarterPlayer, ClientSync, DebugModeOverride) -- Can leave blank to have defaults, ex: local tweenHandler = EasyTween.new()
ex: local tweenHandler = EasyTween.new(true,true,false,false)
4: Wherever you wanna tween (such as in a function, go about doing a regular tweenService:Create() but make tweenInfo in a table, ex: {time, easingstyle, easingdirection}
To make it tween for EVERYONE:
tweenHandler:TweenAllClients(objectToChange, TweenInfoTable, ValuesToTweenTable)
-- Keep in mind that tweeninfo table is not TweenInfo.new() and is "{ Tweeninfo values here }"
Ex: tweenHandler:TweenAllClients(objectToChange, {1.5, Enum.EasingStyle.Linear}, {Position = Vector3.new(0,5,0})
To make it tween for ONLY ONE person:
local playerObject = game.Players.HiddenKaiser
tweenHandler:TweenClient(playerObject, objectToChange, TweenInfoTable, ValuesToTweenTable)
Ex: tweenHandler:TweenClient(playerObject, objectToChange, {1.5, Enum.EasingStyle.Quad}, {Position = Vector3.new(0,5,0})
If you have any ideas on modules or open source things you want tell me below!