Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

3 comments

0

Is it set to action?

0

Maybe stop player from moving and then made player able to move

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.

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.