Animation overriding others played afterward despite being of the same/lower priority

This code executes when the player holds down SHIFT:

anim:Play(1)

The priority of this animation is Movement, just like the jumping animation that is supposed to happen when you press Space. I’ve even tried making the jumping animation Action, and I’ve tried making this animation Idle, but to no avail.

The slow walking is from the Animate script, as well as the (janky, but that’s a problem for another day) jumping and falling animation. The running is executed from the script in the OP, and as you can see when the fade time finishes it overrides the jumping.
This is the script that houses the small excerpt from before:

local speed = 25
local norm_spd = 10
local ke_y = Enum.KeyCode.LeftShift

wait()
local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
hum.WalkSpeed = norm_spd
local fovMax = { FieldOfView = 70 + (speed/5) }
local fovMin = { FieldOfView = 70 }
local thing = game.Workspace.CurrentCamera
local tween = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMax)
local tween2 = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMin)
local tween3 = game.TweenService:Create(hum, TweenInfo.new(1, Enum.EasingStyle.Cubic), { WalkSpeed = speed })
local tween4 = game.TweenService:Create(hum, TweenInfo.new(1, Enum.EasingStyle.Cubic), { WalkSpeed = norm_spd })
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input, processed)
   if processed then return end
   if input.UserInputType == Enum.UserInputType.Keyboard then
   		if input.KeyCode == ke_y then
			tween3:Play()
			anim = hum:LoadAnimation(script.run)
			anim:Play(1)
			tween3.Completed:Connect(function()
				tween:Play()
			end)
   		end
	end
end)

UIS.InputEnded:Connect(function(input) 
	if input.KeyCode == ke_y then
		--game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = norm_spd
		tween4:Play()
		anim:Stop(1)
		tween4.Completed:Connect(function()
			tween2:Play()
		end)
	end
end)

help please.

1 Like

I should also mention I am replacing the default animations using a forked Animate script in StarterCharacterScripts.

1 Like

Wait, could you take a video of this in play mode so I could see it better?

The slow walking is from the Animate script, as well as the (janky, but that’s a problem for another day) jumping and falling animation. The running is executed from the script in the OP, and as you can see when the fade time finishes it overrides the jumping.

Here’s the whole script mentioned.

local speed = 25
local norm_spd = 10
local ke_y = Enum.KeyCode.LeftShift

wait()
local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
hum.WalkSpeed = norm_spd
local fovMax = { FieldOfView = 70 + (speed/5) }
local fovMin = { FieldOfView = 70 }
local thing = game.Workspace.CurrentCamera
local tween = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMax)
local tween2 = game.TweenService:Create(thing, TweenInfo.new(0.4, Enum.EasingStyle.Sine), fovMin)
local tween3 = game.TweenService:Create(hum, TweenInfo.new(1, Enum.EasingStyle.Cubic), { WalkSpeed = speed })
local tween4 = game.TweenService:Create(hum, TweenInfo.new(1, Enum.EasingStyle.Cubic), { WalkSpeed = norm_spd })
local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input, processed)
   if processed then return end
   if input.UserInputType == Enum.UserInputType.Keyboard then
   		if input.KeyCode == ke_y then
			tween3:Play()
			anim = hum:LoadAnimation(script.run)
			anim:Play(1)
			tween3.Completed:Connect(function()
				tween:Play()
			end)
   		end
	end
end)

UIS.InputEnded:Connect(function(input) 
	if input.KeyCode == ke_y then
		--game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = norm_spd
		tween4:Play()
		anim:Stop(1)
		tween4.Completed:Connect(function()
			tween2:Play()
		end)
	end
end)

Bumping because this is not solved

why do none of my posts get answers. it is frustrating.

edited the original post to house all information

Have you found the solution I’ve been trying to fix the same problem for hours