Unsure on how to make this work (TWEENING AND MODULES)

So I am making a module to make my “experience” way easier to work with, and I want to make the tween module to have an enterable value and to set it to
so for example

I want Transparency to be set to 0

I could put it like

basicfunc.CreateTween(model.Head,1,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,"Transparency",1)

However, I do not know how to be able to make the Transparency and the 1 (at the end) be apart of the tween itself, however I cannot do the idea I had

	local tweener = game.TweenService:Create(part,TweenInfo.new(sec,easingstyle,easingdirection,0,false,0),{value = to})

This errors because the part seeks for something to change by the name of “value”
And I have no idea how to make this work.

However, I do not know how to be able to make the Transparency and the 1 (at the end) be apart of the tween itself

If you mean you’re having troubles with passing the arguments through, take a look at the code snippet below~

-- ModuleScript

local Module = {}

--[[
    Example usage:

    Module.tween(model.head, TweenInfo.new(...), { value = 0 })
]]
function Module.tween(instance, tweenInfo, propertyTable)
    return TweenService:Create(instance, tweenInfo, propertyTable):Play()
end

return Module

This would play a tween using a function inside of a ModuleScript. If you mean something else, let me know.

I’ll see if I can get this working, but yes I want it to play a tween in the modulescript

I’m failing to get it to work, this is how the module getting called looks like

basicfunc.Tween(model.Head,TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0),"Transparency = 0")

Erroring with Unable to cast to dictionary

The third argument needs to be a table and not a string:

basicfunc.Tween(model.Head,TweenInfo.new(1,Enum.EasingStyle.Cubic,Enum.EasingDirection.Out,0,false,0),{Transparency = 0})
1 Like

Works as I wanted! Thank you for helping!

1 Like