I have a part and when you touch it, it changes your character animation. Basically there is a flaw in roblox’s animation system where the new animations will only play once you stop moving, then start moving again. I want to know if there is a trick or something I can do to fix this.
Set the animation to top priority:
local Animation = script.Animation --path to animation object
local Humanoid = script.Humanoid --path to humanoid
local Track = Humanoid:LoadAnimation(Animation)
Track.Priority = Enum.AnimationPriority.Action
Track:Play()
To get an animation to play without a fade in:
AnimationTrack:Play(0)
I think you might be talking about the default Animate script and switching out an animation?
You could probably either make some changes to the Animate script or possibly switch the Humanoid’s state out of running then back to running.
where do I put in the animation id?
Animation.AnimationId = "your animation id"
Yeah I still have no idea what you mean or how it will work. Here is the context of my script:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
hit.Parent.Animate.walk.WalkAnim.AnimationId = "rbxassetid://8137104876"
hit.Parent.Animate.idle.Animation1.AnimationId = "rbxassetid://8137256167"
hit.Parent.Animate.idle.Animation2.AnimationId = "rbxassetid://8137256167"
hit.Parent.Humanoid.WalkSpeed = 6
hit.Parent.Humanoid.JumpPower = 0
end
end)
Why did you delete your post, I didn’t get to read it yet
This may be helpful:
I don’t want to change the default animation, the script I have only changes the animation when I touch a part. Also it says that is for testing purposes
I got it to work by setting the humanoid walkspeed to 0, waiting 1/10 of a second, then setting Humanoid walkspeed to normal. Here is the updated script:
local debounce = 0
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil and debounce == 0 then
debounce = 1
hit.Parent.Humanoid.WalkSpeed = 0
hit.Parent.Animate.walk.WalkAnim.AnimationId = "http://www.roblox.com/Asset?ID=8137104876"
hit.Parent.Animate.idle.Animation1.AnimationId = "http://www.roblox.com/Asset?ID=8137256167"
hit.Parent.Animate.idle.Animation2.AnimationId = "http://www.roblox.com/Asset?ID=8137256167"
hit.Parent.Humanoid.JumpPower = 0
wait(0.1)
hit.Parent.Humanoid.WalkSpeed = 6
wait(1)
debounce = 0
end
end)
It is almost unnoticeable in the game, so I will use this every time when changing animations, as it seems like the easiest method.