#how to make my animation override roblox movement?

1 messages · Page 1 of 1 (latest)

versed oriole
#
local animation = script.Animation
local hum = script.Parent:WaitForChild("Humanoid")
local animTrack = hum:LoadAnimation(animation)
animTrack.Priority = Enum.AnimationPriority.Action
local isPlayingAnim = false

hum.Running:Connect(function(speed)
    if speed > 0 then
        if isPlayingAnim then return end
        animTrack:Play()
        isPlayingAnim = true
    else
        if not isPlayingAnim then return end
        isPlayingAnim = false
        animTrack:Stop()
    end
end)

the anim is mixed with roblox default movement, how do I make it override without having to delete animate script

restive kernel
#

put this local function above hum.running and below local isPlayingAnim it will basically catch the walk animation or run which are the names of the roblox default anims and stop them from playing.

local function stopDefaultMovement()
for _, track in animator:GetPlayingAnimationTracks() do
if track.Name == "Walk" or track.Name == "Run" then
track:Stop()
end
end
end

so when you put animTrack:Play() write it like this:

stopDefaultMovement()
animTrack:Play()

and it should stop the default anims without you having to delete anything if the name of your animation is "Run" then either change it or remove this, or track.Name == "Run" part of the script. if this doesnt work ping me and i will try help again.

#

also let me know if it does work

restive kernel
#

@versed oriole

restive kernel
versed oriole
restive kernel
#

the error is happening i assume because you changed animator:GetPlayingAnimationTracks to animate:GetPlayingAnimationTracks

#

local animator = hum:WaitForChild("Animator")

#

put that above the local function

#

and it should work

#

and change back animate to animator:GetPlayingAnimationTracks

#

@versed oriole

versed oriole
#

Although I can try again