How to change the walking animation if you are equipping something/carrying something (In my case at least)

Currently, I’m trying to create a walking animation that only activates if I am carrying this rock, the issue being is that the actual walking just completely breaks, so I don’t really know what I should do at the moment.

-- \\ P-Prompt // --

local PU = script.Parent

local ROC = script.Parent.Parent

-- \\ Misc. Variables // --

local RockCarrying = false

-- \\ Functions // --

PU.TriggerEnded:Connect(function(Player)
	local RF = game:GetService("ReplicatedFirst")

	local Rock = RF.Animations.PickUpRock
	local RockWalk = RF.Animations.WalkingRock
	local RockIdle = RF.Animations.IdleRock

	local RockAnim = Player.Character.Humanoid.Animator:LoadAnimation(Rock)
	local RockIdleAnim = Player.Character.Humanoid.Animator:LoadAnimation(RockIdle)
	local RockWalkAnim = Player.Character.Humanoid.Animator:LoadAnimation(RockWalk)
	print(Player)
	print("It works?")

	RockAnim:Play()
	RockAnim.Stopped:wait()
	
	local Weld = Instance.new("Motor6D")
	Weld.Parent = Player.Character.HumanoidRootPart
	Weld.Part0 = Player.Character.HumanoidRootPart
	Weld.Part1 = ROC
	RockCarrying = true
	print("Oomph!")
	
	if RockCarrying == true then
		RockIdleAnim:Play()
	end
	
	
	Player.Character.Humanoid.Running:Connect(function(IsWalking)
			if IsWalking > 1 and RockCarrying == true then
				RockWalkAnim.Looped = true
				RockWalkAnim:Play()
			else
				RockWalkAnim:Stop()
		end
	end)

end)
1 Like