Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get my run animation to play while i'm already walking?

Asked by 3 years ago
Edited 3 years ago

I've been experiencing with my own custom animated sprint script and i'm having problems with the Animation starting when i'm running but not when i'm standing still. here is my method:

local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local isSprinting = false

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.LeftShift and isSprinting == false then
        isSprinting = true
        Player.Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=5202688739"
        Player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=5202688739"
        Player.Character.Humanoid.WalkSpeed = 25
        if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then
            local Track = Instance.new("Animation")
            Track.AnimationId = "rbxassetid://5202688739"
            local Anim = Player.Character.Humanoid:LoadAnimation(Track)
            Anim:Play()
        end     
    end
end)

UIS.InputEnded:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.LeftShift and isSprinting == true then
        isSprinting = false
        Player.Character.Animate.run.RunAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354"
        Player.Character.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/asset/?id=180426354"
        Player.Character.Humanoid.WalkSpeed = 16
        if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.S or input.KeyCode == Enum.KeyCode.D then
            local Track = Instance.new("Animation")
            Track.AnimationId = "rbxassetid://180426354"
            local Anim = Player.Character.Humanoid:LoadAnimation(Track)
            Anim:Play()
        end     
    end
end)
0
Did you set your animation to action in animation editor? If its at core then set it to action lilzy7 68 — 3y
0
ye try setting it to action themaxogamer 58 — 3y
0
I wasn't having problems activating the animation I was having problems stopping the animation from activating if the Player wasn't already walking. Sorry if the Title mislead you AuraBeast1 8 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Make Sure your Animation is actually set to Action, The System goes like this, Core -> Idle -> Movement -> Action, If your Using ****Animation Editor****, Click the Three Dots, Proceed to ****Animation Priority**** and Choose Action.

0
I wasn't having problems activating the animation I was having problems stopping the animation from activating if the Player wasn't already walking. Sorry if the Title mislead you. AuraBeast1 8 — 3y
Ad

Answer this question