bro so at function animations:stopAnimation()
when i do self.currentAnimation:Stop()
it says attempt to index nil with Stop
when you can clearly see its not nil in the above function because it plays after
function animations.new()
local newAnimationHandler = setmetatable({
currentAnimation = nil
}, animations)
return newAnimationHandler
end
function animations:playAnimation(animation)
if self.currentAnimation then return end
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid")
self.currentAnimation = humanoid:LoadAnimation(animation) --now its not nil
self.currentAnimation:Play() -- it works
end
function animations:stopAnimation()
self.currentAnimation:Stop() -- it says its nil?????????????????????????
self.currentAnimation = nil
end