So I have a Script that runs an animation, but I want it to have the Run Animation after like normal after the anim plays.
UIS.InputBegan:Connect(function(input,pro)
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
-- Boost
if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
local ofset = 5
humanoid.WalkSpeed = 50
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://" .. tostring(myAnimId)
local animTrack = humanoid.Animator:LoadAnimation(animation)
for _, playingTrack in pairs(humanoid.Animator:GetPlayingAnimationTracks()) do
playingTrack:Stop(0)
if not Run then
ofset = 0
break
end
if animTrack and animTrack:IsA("AnimationTrack") and not animTrack.IsPlaying then
animTrack:Play()
end
end
wait(ofset)
animTrack:Stop()
humanoid.WalkSpeed = 20
--insert code to walk here
end
end)
Could you elaborate further? I cannot understand what you want to achieve based on your post. But from my observation on your code, I recommend loading the animation only once and you should not stop all animations that are playing, instead you can modify an AnimationTrack’s Priority property.
Well I think you should not stop all the playing animations. Instead you can modify your AnimationTrack’s Priority property to Action so it would overwrite the animations that are already playing and then when the animation stops, the animations that are being handled by the Animate script can naturally resume all of it.