I’ve never once used a ModuleScript before but want to try learning it. I often find myself rewriting tweens in my code and thought that I might be able to utilize a ModuleScript to make tweening things easier in my projects.
Basically there would be one server script which gets put into the object I want to tween and then there is a ModuleScript inside ServerStorage.
I’m currently working on the server script. I want it to be easy for me to edit all of the tween variables such as duration, easingStyle, easingDirection, etc.
Right now I have just a bunch of variables in the script that get passed as parameters through a function to the ModuleScript. Is this the easiest way to do this? Would just adding attributes to the part be easier? Or some other way?
Any ideas?
Server script:
local tweenModule = require(game:GetService("ServerStorage"):WaitForChild("TweenModule"))
local part = script.Parent
local easingStyle = "Linear"
local easingDirection = "Out"
local repeatCount = 0
local reverseTween = false
local delayTime = 3
local tweenType = "Position"
local distance = 20
local function tweenPart()
tweenModule.TweenPart(part, easingStyle, easingDirection, repeatCount, reverse, delayTime, tweenType, distance)
end
part.Touched:Connect(tweenPart)
(I’m aware some properties of the tween are not included, I never finished adding all of them)