Can't use tool animation and walk animation at the same time

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Getting the character’s walking animation play when the player walks and drinks the bloxy cola at the same time

  2. What is the issue? The walking animation stops if I drink the Bloxy Cola and walk at the same time

  3. What solutions have you tried so far? I didn’t look for solution on the Developer Hub, I remade the code (it’s below this text) and nothing really changed.

This is my code:

local tool = script.Parent
local tooltip = "It tastes different."
local handle = tool.Handle
local animations = {
	drink = {
		R6 = script.Parent.DrinkAnimation;
		R15 = script.Parent.DrinkAnimationR15;
	};
}

local health = 5 -- change this to the health you want to restore for the bloxy cola (set to 0 for none)
local sips = math.huge -- set math.huge for infinite, put another number if you want to make it limited.

local function drink()
	local humanoid = tool.Parent:FindFirstChildWhichIsA("Humanoid")
	if humanoid then
		local originalWalkSpeed = humanoid.WalkSpeed
		humanoid.WalkSpeed = 0

		local animator = Instance.new("Animator")
		animator.Name = "BloxyColaAnimator"
		animator.Parent = humanoid

		if humanoid.RigType == Enum.HumanoidRigType.R6 then
			if sips > 0 then
				local animationTrack = animator:LoadAnimation(animations.drink.R6)
				animationTrack:Play()
				humanoid.Health = humanoid.Health + health
				sips = sips - 1
				tool.ToolTip=tooltip.." ("..tostring(sips)..")"
			end
		elseif humanoid.RigType == Enum.HumanoidRigType.R15 then
			if sips > 0 then
				local animationTrack = animator:LoadAnimation(animations.drink.R15)
				animationTrack:Play()
				humanoid.Health = humanoid.Health + health
				sips = sips - 1
				tool.ToolTip=tooltip.." ("..tostring(sips)..")"
			end
		end

		humanoid.WalkSpeed =  originalWalkSpeed
	end
end

tool.Activated:Connect(drink)

Set the drink animation to action in the animator editor.

I use Moon Animator 2, is that good?
Edit: nvm now I understand what you’re saying

I see it’s action already.
image

It might be an issue with your animation, did you animate the legs at all? Because if there are keyframes there it will mask the walk animation.

I didn’t animate the legs at all. I only animated the right arm and the head.

I just did a work-around instead. You won’t be able to drink the Bloxy Cola while walking.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.