So I’ve been trying to make a smooth animation transition, as when they player equips their sword their animations change. I’m doing this by changing the AnimationId of the animations in the animate script, then running a “fake” animation of the animation that would be playing in the new set, until a new animation is played. Then the “fake” animation get deleted and the track stops playing. The only problem is that it works initially… and but after a new track is played and the “fake” animation is deleted, the animation played using the animate script just… breaks.
Gyazo video for explanation, first two shots display it working on the client and the server, then I move and it works on the client, but not the server. https://gyazo.com/2281d1fcc6ba54b43479af7006545670
A few things to note:
- This is all done locally
- I stop ALL animation tracks before playing the “fake” animation track
- Script checks if the new animation being played is the same as the “fake” animation
- The animation is in R6
- The animation has 7 parts, the sword I mentioned earlier being the seventh
Heres the script if you need it /
if V == "E" then
AnimScript.idle.Animation1.AnimationId = "http://www.roblox.com/asset/?id=11496743193"
elseif V == "S" then
AnimScript.idle.Animation1.AnimationId = "http://www.roblox.com/asset/?id=180435571"
end
local state
for _, animationTrack in Character.Humanoid.Animator:GetPlayingAnimationTracks() do
state = animationTrack.Name
animationTrack:Stop()
end
if state == "Animation1" then
local newAnim = Instance.new("Animation")
newAnim.AnimationId = AnimScript.idle.Animation1.AnimationId
local newTrack = Character.Humanoid:LoadAnimation(newAnim)
newTrack:Play()
newTrack.Looped=true
Animator.AnimationPlayed:Connect(function(animation)
if animation ~= newAnim then
newTrack:Stop()
newAnim:Destroy()
end
end)
end
Any help would be appreciated.