#Animation mixed bug

1 messages · Page 1 of 1 (latest)

upper kayak
#

the txt is the local script of my tool
and there the module script of my anime handler

local AnimationHandler = {}
AnimationHandler.__index = AnimationHandler

function AnimationHandler.new(humanoid)
    local self = setmetatable({}, AnimationHandler)
    self.humanoid = humanoid
    self.animations = {}
    self.tracks = {}
    self.currentTracks = {}   
    self.animator = humanoid:WaitForChild("Animator")
    return self
end

function AnimationHandler:AddAnimation(name, animationId, Priority)
    local anim = Instance.new("Animation")
    anim.AnimationId = animationId
    self.animations[name] = anim
    self.tracks[name] = self.animator:LoadAnimation(anim)
    local track = self.tracks[name]
    track:Play(0)
    track.Priority = Priority
    track:Stop()
end

function AnimationHandler:Play(name, slot)
    slot = slot or "default"

    -- Stop old track in the same slot
    if self.currentTracks[slot] then
        self.currentTracks[slot]:Stop()
    end

    local track = self.tracks[name]
    if track then
        track:Play()
        self.currentTracks[slot] = track
    end
    return track
end

-- Stop a specific slot
function AnimationHandler:Stop(slot)
    slot = slot or "default"
    if self.currentTracks[slot] then
        self.currentTracks[slot]:Stop()
        self.currentTracks[slot] = nil
    end
end

return AnimationHandler
#

like the sword go in the air for no reason

#

for all animation

#

idle walk run fall jump . . .

upper kayak
upper kayak
small badger
#

iirc it's because there's a small window where no animation plays at all meaning the sword just goes to its idle position on the model

#

could be wrong, not a scripter or animator really

#

just trying to help

#

the script cuts off, is there a point in where the sword is welded to the body or something?

#

I'm wondering if it's because of two animations playing at once causing the sword position to become wonky