Walking/Running Anims makes me cry

I’m trying to make a basic movement animation script with running and walking, but I swear every time I try to do this it always ends up with the weirdest jank.
Randomly a player will just slide across the floor with an A-Pose, and that just ruins the whole thing.
I tried using LocalScripts at first, I tried Scripts with RemoteEvents, and it only got worse and worse.

I have no idea how to fix this issue and I’m going to break into hysterical screaming.


-- LOCAL SCRIPT IN STARTERCHARACTERSCRIPTS

local UIS = game:GetService("UserInputService")
local chr = script.Parent
local hrp = chr:WaitForChild("HumanoidRootPart")
local hum = chr:WaitForChild("Humanoid")
local animr = hum:WaitForChild("Animator")

local walkspeed = 12
local runspeed = 24
task.wait()
local walk = animr:LoadAnimation(script:WaitForChild("Run"))
local run = animr:LoadAnimation(script:WaitForChild("Run"))
walk.Looped = true
run.Looped = true
walk:Play(0,0,.5)
run:Play(0,0,1)
local sprinting = true

hum.WalkSpeed = runspeed

UIS.InputBegan:Connect(function(k,p)
	if k.KeyCode == Enum.KeyCode.LeftShift or k.KeyCode == Enum.KeyCode.LeftControl then
		sprinting = false
		hum.WalkSpeed = walkspeed

	end
end)

UIS.InputEnded:Connect(function(k,p)
	if k.KeyCode == Enum.KeyCode.LeftShift or k.KeyCode == Enum.KeyCode.LeftControl then
		sprinting = true
		hum.WalkSpeed = runspeed
	end
end)

game:GetService("RunService").RenderStepped:Connect(function()
	if hrp.AssemblyLinearVelocity.Magnitude > 0.5 then -- checks for movement on RootPart rather than Humanoid
		if hum.FloorMaterial ~= Enum.Material.Air then -- Airborne Test
			if hum.WalkSpeed > walkspeed then -- I probably should've used the Magnitude of HRP.X and HRP.Z to check this.
				walk:AdjustWeight(0)
				run:AdjustWeight(1)
				if hrp:FindFirstChild("Running") then
					hrp:FindFirstChild("Running").Volume = .5
				end
			else
				walk:AdjustWeight(1)
				run:AdjustWeight(0)
				if hrp:FindFirstChild("Running") then
					hrp:FindFirstChild("Running").Volume = 0
				end
			end
		else
			walk:Play(0,0,.5)
			run:Play(0,0,1)
		end
	else
		walk:Play(0,0,.5)
		run:Play(0,0,1)
	end
end)

Before people ask, the animations are published in my account, the game is solely owned by me, and no, I cannot disguise as Saxton.

What is the animation priority? It could be too low which is why it mixes up with the default animations.

The priority is set to Movement, but I don’t know how that could mess up with the default animations because I set the default walking animation to nothing (a completely blank animation with no modifications).

Can you run the game with this script disabled and see if the default animations are playing? Just to make sure.

Wait I think I may have found the issue, the animation I set for default walking has a weight of 10, I’m gonna check and see if that was the problem.

Didn’t fix a thing.

Also the issue with this that I should’ve mentioned earlier is that the animation works perfectly fine on the client, but other players on the screen will have the issue.

Untitled video (12)
Here’s what the issue looks like, player sometimes has the animation and sometimes doesn’t…

1 Like