I am trying to learn Object-Oriented Programming. So the first project I wanted to do with it is an Animation Module. In which you can give out arguments and start it with its own function! Pretty cool but I can’t wrap my head around this Output so I don’t know how to fix this problem.
The Module,
local Animation = {}
Animation.__index = Animation
function Animation.New(obj, timer, reverse, TweenProperties)
return setmetatable({
track = game:GetService("TweenService"):Create(obj, TweenInfo.new() , 0, reverse, 0,TweenProperties)} -- Output says this line has a problem!
,Animation)
end
function Animation:Start()
self.track:Play()
end
return Animation
When I make a script like this,
local Animator = require(script.Parent.Animator)
local Hinge = workspace.Plot_a.Home.Door:WaitForChild("Hinge")
local DoorAnim = Animator.New(Hinge, 0.25, true, {CFrame = Hinge.CFrame*CFrame.Angles(0,-90,0)}) -- Output says this line has a problem!
DoorAnim:Start()
The output says this,
Unable to cast to Dictionary
