How to "unspecify" something in a ModuleScript

I just started using ModuleScripts, and I want to simplify the GUI tweening process by putting a bunch of different animation presets in the ModuleScript (for example, one to fade, one to move off screen, etc), however, I don’t know how to do this or how I should go about doing it.
so far I have

local AnimationController = {}

local TweenService = game:GetService('TweenService')
local guiObject = nil

TweenService:Create(
	guiObject,
	TweenInfo.new(2),
	{BackgroundTransparency = 1}
								):Play()

return AnimationController

if this is correct, can I keep adding more?

Second question:
How do I call a specific animation and not the whole thing? Or would I need a whole other modulescritp?
thanks for any help

create a function for add a index to the constructor:

AnimationController.Key = "Hello!" -- Random index (as an example)

function AnimationController.CreateAnimation(Item, Dur, Goal) -- Module function with Parameters
    local Tween = TweenService:Create(Item, Dur, Goal) -- Creates Tween
    return Tween -- returns the Tween
end)

Script:

print(ModuleScript.Key) --> Hello!

local Anim = ModuleScript.CreateAnimation(guiObject, TweenInfo.new(2), {BackgroundTransparency = 1}) -- Vairable Assigned as the returned Data
Anim:Play() -- Plays Tween

ModuleScripts are intended for storing Information and to follow the DRY Principle which means Don’t Repeat yourself

You can look up all this info yourself:
https://create.roblox.com/docs/reference/engine/classes/ModuleScript

1 Like