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

How to make an animation refresh when its ID is changed while it is playing?

Asked by 5 years ago

I'm trying to change the default running animation's ID for a running script, but when I change the run animation's ID (which is a walk one for when not running) to a running animation ID, the new animation only starts playing when I stop moving then move again. The animation doesn't change while it is playing and I couldn't find any way to force it to refresh without making it randomly glitch.

0
Is it set to action? SimpleFlame 255 — 5y
0
Maybe stop player from moving and then made player able to move dinozaver_triceratop 78 — 5y
0
I'm not using any custom animations only changing default animations with other roblox default ones, so I can't edit the priority. But how could I make it stop moving? I''m pretty sure anchoring the humanoid root part or similar could create problems, and if the character is flung (explosion for example) it would stop in mid air. CreatorMan2006 -2 — 5y

1 answer

Log in to vote
0
Answered by 3 years ago

if you use the .jump in the humanoid you can refresh the character that way you can make it look smoother by making the jump power very low and removing the jump animation temporarily then setting them back to normal as shown

local function jump()
            --variables
            local char = game:GetService("Players").LocalPlayer.Character
            local animate = char:WaitForChild("Animate")
            local jump = animate:FindFirstChild("jump")
            local jumpanim = jump:FindFirstChild("JumpAnim")

            jumpanim.AnimationId = "rbxassetid://" --remove the animation

            char.Humanoid.JumpPower = 0.01 --changes jump power
            char.Humanoid.Jump = true --makes the player jump
            wait()
            char.Humanoid.JumpPower = 50 --resets jump power
            jumpanim.AnimationId = "rbxassetid://5742579549" --resets animation to normal (the id is my own not the default jump animation id)
        end

spawn(jump)
Ad

Answer this question