Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Idle animation for my tool is overriding my attack animation, help?

(Read to bottom)

When I equip my hammer tool, it plays an idle animation because of the following Local Script:

local tool = script.Parent
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://6636798666"
local track
tool.Equipped:Connect(function()
	track = script.Parent.Parent.Humanoid:LoadAnimation(Anim)
	track.Priority = Enum.AnimationPriority.Action
	track.Looped = true
	track:Play()
end)

tool.Unequipped:Connect(function()
	if track then
		track:Stop()
	end
end)

I added another normal Script into the tool, so that when you click, the attack animation plays:

local Tool = script.Parent
local Animation = Tool.Animation

Tool.Activated:Connect(function()
	local Character = Tool.Parent
	local Humanoid = Character.Humanoid	
	wait(3)
	local AnimationTrack = Humanoid:LoadAnimation(Animation)
	AnimationTrack:Play()
end)

I'm having a slight problem though, when I click for the attack animation to play, the arms that are supposed to move when the attack animation plays don't move. Its almost like the arm's movements are being voided because of the idle animation.

I want to know if there is anything I can add to the ATTACK ANIMATION script (second script shown) that will temporarily disable the IDLE ANIMATION (first script shown) Local Script so the attack animation can play, and then when it is finished, the idle animation will begin playing again, and the idle animation's local script will start running.

How can I do this?

1 comment

0

When you create the animation there are 4 settings ( Action & 3 more i forgot the names) u need to set the correct setting for idle

1 answer

Marking as SOLVED because I've fixed the problem :)

This discussion is preserved as it was. New answers, comments, and votes are closed.