Change the walking and idle animation when tool (Motor6D attached tool) is equipped

Hello, I would like to know how I change the walking and idle animation of a tool I have, just that it is not a tool. It is a model that is attached to Motor6D’s to the body, and I have no clue on how to change the animation. In previous places of mine, I just switched the animate script in the player with another one with the animation ID’s changed, but it seems really impractical now. I also changed the jump and fall in these scripts, and I might need it here too.

Here is a video of what I have now (ignore my bad animation)

How would I go about doing this?
Thanks for any help in advance.

I cant really think of any way of modifying the current animation ID of the animate script. Ive done something similar on my games and the only way I could get around with it was having 2 animate scripts (one for normal animations and the other for sword animations) and whenever you equip / unequip the animation it would enable and disable them

For example, lets say you equip the sword. You would enable the sword animations animate script and disable the normal animations animate script.

I have just been messing around with loops for a few hours, and it has begun to work, but thanks for the advice!

1 Like

Oh thats nice! If in whatever case it bugs out or doesnt work properly I would highly recommend using my method even if it is kind of impractical, glad could help! :slight_smile:

1 Like

I don’t understand the replies above, this is definitely possible

What I do is I add a script to the character that plays movement/idle animations based on an override track table. This doesn’t replace the animations it just plays another track on top. If you use all the character parts this isn’t an issue, and sometimes its exactly what you want. (e.g, idle animation only changes the arms but not the legs or torso).

Make sure your animation priorities are higher than Core

local loadedTracks = {} -- Accepts {Walk = animTrack, Idle = animTrack}. If not enough uses default animation
local defaultSprintTrack = humanoid:LoadAnimation(game.ReplicatedStorage.Assets.Animations.Sprint)

local function updateAnimation()
	local animToPlay = "Idle"
	
	if humanoid.MoveDirection.Magnitude ~= 0 then
		animToPlay = "Walk"
		if sprintState.Value then
			animToPlay = "Sprint"
		end
	end
	
	for i, v in loadedTracks do
		if i == animToPlay then
			if not v.IsPlaying then
				v:Play()
			end
		else
			v:Stop()
		end
	end
end

humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(updateAnimation)
sprintState.Changed:Connect(updateAnimation)

When you equip the tool you have to update the trackTable somehow with the new movement tracks (most likely using attributes, a module, or a bindable) then call updateAnimation.

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