An issue regarding cutsom rigs, humanoids, and Humanoid.Running

So, I’ve noticed the strangest little bug in my game. And to be honest this might just be Roblox’s fault.

Basically, in Roblox studio, I have this animation script that belongs to a custom horse model. When “humanoid.Running” is fired, and the unit is above a certain speed, the walk animation plays. Else, it stops.

This works perfectly fine! I’ve had no Issues and it’s great… In studio. My problem is, as soon as I move this test to actual Roblox, Humanoid.Running only fires one time (When the humanoid is spawned in), and then NEVER AGAIN?

Now here’s where it gets even weirder, so listen closely. I have this exact same script for a normal rig, just a plain R6 character. It works in studio AND in game. But as for the horse, no dice.

Here’s the code for reference:

function ActionCalvary(UnitInstance)
	
	UnitInstance.HumanoidRootPart.HorseTrot:Play()
	
	Vanitize(UnitInstance.Knight,"Knight")
	
	local IdleAnim = UnitInstance.Knight.Humanoid.Animator:LoadAnimation(script.Animations.Ride)
	
	IdleAnim:Play()
	
	--task.spawn(function()
	--	while wait(.25) do
	--		if UnitInstance.HumanoidRootPart.Velocity.Magnitude < 1 then
				
	--			local RandomChance = math.random(1,400)

	--			if RandomChance <= 3 then
	--				UnitInstance.HumanoidRootPart:FindFirstChild("Snort"..RandomChance):Play()
	--			end
	--		end
	--	end
	--end)

	local WalkAnimation = UnitInstance.Humanoid.Animator:LoadAnimation(script.Animations.Walk)
	local RunAnimation = UnitInstance.Humanoid.Animator:LoadAnimation(script.Animations.Run)
	local IdleAnimation
	local ChargeAnimation

	local Animation = Instance.new("Animation")

	Animation.AnimationId = UnitData[UnitInstance.UnitType.Value]["Animations"]["Idle"][math.random(1,#UnitData[UnitInstance.UnitType.Value]["Animations"]["Idle"])]
	IdleAnimation = UnitInstance.Humanoid.Animator:LoadAnimation(Animation)

	local Animation = Instance.new("Animation")

	Animation.AnimationId = UnitData[UnitInstance.UnitType.Value]["Animations"]["Walk"][math.random(1,#UnitData[UnitInstance.UnitType.Value]["Animations"]["Walk"])]
	WalkAnimation = UnitInstance.Humanoid.Animator:LoadAnimation(Animation)

	local Animation = Instance.new("Animation")

	Animation.AnimationId = UnitData[UnitInstance.UnitType.Value]["Animations"]["Run"][math.random(1,#UnitData[UnitInstance.UnitType.Value]["Animations"]["Run"])]
	RunAnimation = UnitInstance.Humanoid.Animator:LoadAnimation(Animation)

	if UnitData[UnitInstance.UnitType.Value]["Animations"]["Charge"] then

		local Animation = Instance.new("Animation")

		Animation.AnimationId = UnitData[UnitInstance.UnitType.Value]["Animations"]["Charge"][math.random(1,#UnitData[UnitInstance.UnitType.Value]["Animations"]["Charge"])]
		ChargeAnimation = UnitInstance.Humanoid.Animator:LoadAnimation(Animation)
	end

	UnitInstance.Humanoid.Running:Connect(function()

		WalkAnimation:AdjustSpeed(UnitInstance.Humanoid.WalkSpeed/10)
		RunAnimation:AdjustSpeed(UnitInstance.Humanoid.WalkSpeed/10)

		if UnitInstance.Humanoid.Health > 1 then

			local Velocity = Vector3.new(UnitInstance.HumanoidRootPart.Velocity.X,0,UnitInstance.HumanoidRootPart.Velocity.Z).Magnitude

			if Velocity > UnitData[UnitInstance.UnitType.Value]["WalkSpeed"] + 1 then

				UnitInstance.HumanoidRootPart.Dust.ParticleEmitter.Enabled = true

				if UnitInstance.IsCharging.Value == true then

					RunAnimation:Stop()
					WalkAnimation:Stop()
					IdleAnimation:Stop()

					if ChargeAnimation.IsPlaying == false then

						ChargeAnimation:Play()

						ChargeAnimation.TimePosition = math.random(0,5000)/100
					end
				else

					ChargeAnimation:Stop()

					if RunAnimation.IsPlaying == false then

						RunAnimation:Play()
						WalkAnimation:Stop()

						RunAnimation.TimePosition = math.random(0,5000)/100

						if UnitData[UnitInstance.UnitType.Value]["Animations"]["Idle"] then
							IdleAnimation:Stop()
						end
					end
				end

				if RunAnimation.IsPlaying == false and UnitInstance.IsCharging.Value == false then

					RunAnimation:Play()
					WalkAnimation:Stop()

					RunAnimation.TimePosition = math.random(0,5000)/100

					if UnitData[UnitInstance.UnitType.Value]["Animations"]["Idle"] then
						IdleAnimation:Stop()
					end
				end

			elseif UnitInstance.Humanoid.MoveDirection ~= Vector3.new(0,0,0) and Velocity > 1 then

				UnitInstance.HumanoidRootPart.Dust.ParticleEmitter.Enabled = false

				if WalkAnimation.IsPlaying == false then

					ChargeAnimation:Stop()
					WalkAnimation:Play()
					RunAnimation:Stop()

					WalkAnimation.TimePosition = math.random(0,5000)/100

					if UnitData[UnitInstance.UnitType.Value]["Animations"]["Idle"] then
						IdleAnimation:Stop()
					end
				end
			else

				UnitInstance.HumanoidRootPart.Dust.ParticleEmitter.Enabled = false

				RunAnimation:Stop()
				WalkAnimation:Stop()
				ChargeAnimation:Stop()

				if UnitData[UnitInstance.UnitType.Value]["Animations"]["Idle"] and IdleAnimation.IsPlaying == false then

					IdleAnimation:Play()

					IdleAnimation.TimePosition = math.random(0,5000)/100
				end
			end
		end
	end)

	--delay(1,function()

	--	WalkAnimation:Stop()
	--	RunAnimation:Stop()
	--	ChargeAnimation:Stop()

	--	IdleAnimation:Play()

	--	IdleAnimation.TimePosition = math.random(0,5000)/100
	--end)

	local Attachment = Instance.new("Attachment")

	Attachment.Parent = UnitInstance.HumanoidRootPart

	--local PreviousHealth = UnitInstance.Humanoid.Health

	--UnitInstance.Humanoid.HealthChanged:Connect(function()
		
	--end)
end

Note: Animation belongs to me, Walk animation priority IS Higher than the idle animation priority

(As you can see in the video, it is NOT working)

4 Likes