I'm having issues with the scripting of an activation animation (.sca already made):
Spoiler: show
I'm trying to take from the megalith code, but no animation occurs, and I don't get an error ?
- Code: Select all
OnStartBeingBuilt = function(self, builder, layer)
CStructureUnit.OnStartBeingBuilt(self, builder, layer)
if not self.AnimationManipulator then
self.AnimationManipulator = CreateAnimator(self)
self.Trash:Add(self.AnimationManipulator)
end
self.AnimationManipulator:PlayAnim(self:GetBlueprint().Display.AnimationActivate, false):SetRate(0)
end,
OnStopBeingBuilt = function(self,builder,layer)
CStructureUnit.OnStopBeingBuilt(self,builder,layer)
if self.AnimationManipulator then
self:SetUnSelectable(true)
self.AnimationManipulator:SetRate(1)
self:ForkThread(function()
WaitSeconds(self.AnimationManipulator:GetAnimationDuration()*self.AnimationManipulator:GetRate())
self:SetUnSelectable(false)
self.AnimationManipulator:Destroy()
end)
end
end,
Please help!