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

A peculiar problem with animation?

Asked by
Chronomad 180
8 years ago

I have this issue with my animation system, in which I am forced to either allow the animations to play infinitely, or allow them to jolt and glitch.

Let me explain

I added line 44 in an attempt to stop the update rolled out by ROBLOX which broke all animations and as a result was said to be disregarded by the OP. See the link here http://devforum.roblox.com/t/animation-optimization-fixes/25450/2

However, with that line in firing, the animations jolt before playing in a very obnoxious way. See here https://gyazo.com/eb3898db20a74a07fe2de35bdaac2d7b

But if I remove this line, the animations seem to play non stop, disregarding the idle animation.

I'm stuck between a rock and a hard place and I could use a hand. Thanks in advance!


--Player Variables-- local Left = Instance.new("Animation") Left.AnimationId = "rbxassetid://416628708" local Right = Instance.new("Animation") Right.AnimationId = "rbxassetid://416628708" local Forward = Instance.new("Animation") Forward.AnimationId = "rbxassetid://416928312" local Backward = Instance.new("Animation") Backward.AnimationId = "rbxassetid://416928338" local Jump = Instance.new("Animation") Jump.AnimationId = "rbxassetid://408621791" local Idle = Instance.new("Animation") Idle.AnimationId = "rbxassetid://416928266" 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} local Event = game.ReplicatedStorage.Events:WaitForChild("AnimationEvent") local Value function onKeyPress(inputObject, gameProcessedEvent) --if State == true then if inputObject.KeyCode == Enum.KeyCode.A then Value = Inputs[1] elseif inputObject.KeyCode == Enum.KeyCode.D then Value = Inputs[2] elseif inputObject.KeyCode == Enum.KeyCode.W then Value = Inputs[3] elseif inputObject.KeyCode == Enum.KeyCode.S then Value = Inputs[4] 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) for _,v in pairs(P.Character.Humanoid:GetPlayingAnimationTracks()) do v:Stop(0) end if speed < 1 then local AnimTrack = P.Character.Humanoid:LoadAnimation(Idle) AnimTrack:Stop() wait(.01) AnimTrack:Play() print("Idle and Awaiting Input") elseif speed > 0 and RunningDebounce == false then RunningDebounce = true local AnimTrack = P.Character.Humanoid:LoadAnimation(Value) AnimTrack:Stop() wait(.01) AnimTrack:Play() print("Moving") RunningDebounce = false end end)

Answer this question