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

Why are my animations so jittery upon being played?

Asked by
Chronomad 180
7 years ago
Edited 7 years ago

This animation handler that I have works without returning errors however, when the animations are played, they stutter as if being started over 4 or 5 times before playing. I just want the animations to play normally and when they are called.

Now, when I don't stop all animations being played in the humanoid, the animations play infinitely over the idle animations (Even while using animtrack:Stop()) , but when I do stop them all, the animations begin to jitter and shake. Taking a few moments to play in most cases. Please help if you can, thanks!

See line 66


--Player Variables-- local Left = Instance.new("Animation") Left.Name = ("Left") Left.AnimationId = "rbxassetid://416628708" local Right = Instance.new("Animation") Right.Name = ("Right") Right.AnimationId = "rbxassetid://428103166" local Forward = Instance.new("Animation") Forward.Name = ("Forward") Forward.AnimationId = "rbxassetid://416928312" local Backward = Instance.new("Animation") Backward.Name = ("Backward") Backward.AnimationId = "rbxassetid://416928338" local Jump = Instance.new("Animation") Jump.AnimationId = "rbxassetid://408621791" local Idle = Instance.new("Animation") Idle.Name = ("Idle") Idle.AnimationId = "rbxassetid://416928266" local Sprint = Instance.new("Animation") Sprint.AnimationId = "rbxassetid://409050900" local already_ran = false local grounded = false local State = false local RunningDebounce = false local P = game:GetService('Players').LocalPlayer repeat wait() until P.Character local Inputs = {Left,Right,Forward,Backward,Jump,Idle,Sprint} local Event = game.ReplicatedStorage.Events:WaitForChild("AnimationEvent") local Value local Walkspeed = script.Walkspeed.Value function playAnimation(parent) local AnimTrack = P.Character.Humanoid:LoadAnimation(parent) AnimTrack:Stop() wait(.01) AnimTrack:Play() --AnimTrack:AdjustSpeed(1.5) end function onKeyPress(inputObject, gameProcessedEvent) --if State == true then if inputObject.KeyCode == Enum.KeyCode.A then Value = Inputs[1] Walkspeed = 12 elseif inputObject.KeyCode == Enum.KeyCode.D then Value = Inputs[2] Walkspeed = 14 elseif inputObject.KeyCode == Enum.KeyCode.W then Value = Inputs[3] Walkspeed = 12 elseif inputObject.KeyCode == Enum.KeyCode.S then Value = Inputs[4] Walkspeed = 10 elseif inputObject.KeyCode == Enum.KeyCode.Space then Value = Inputs[5] end end game:GetService("UserInputService").InputBegan:connect(onKeyPress) P.Character.Humanoid.Running:connect(function(speed) if speed < 1 then for _,v in pairs(P.Character.Humanoid:GetPlayingAnimationTracks()) do v:Stop() end playAnimation(Idle) elseif speed > 0 then for _,v in pairs(P.Character.Humanoid:GetPlayingAnimationTracks()) do v:Stop() end playAnimation(Value) --local e = game.ReplicatedStorage.Events.WalkspeedEvent --e:FireServer(Walkspeed) print(Walkspeed) wait(0.1) end end)

Answer this question