Stephex_s
(Stephex)
December 10, 2021, 4:48pm
#1
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.
Sterpant
(Sterpant)
December 10, 2021, 5:05pm
#2
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.
Stephex_s
(Stephex)
December 10, 2021, 5:10pm
#3
I’ll see if I can get this working, but yes I want it to play a tween in the modulescript
Stephex_s
(Stephex)
December 10, 2021, 5:16pm
#4
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
Sterpant
(Sterpant)
December 10, 2021, 5:18pm
#5
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
Stephex_s
(Stephex)
December 10, 2021, 5:20pm
#6
Sterpant:
{Transparency = 0})
Works as I wanted! Thank you for helping!
1 Like