Changing The Animation When The Tool Is Equipped

Hello, i am trying to make a Advanced Sword System, i made the animations, but i dont know how can i make the walking animation and the idle animation when the Sword is equipped.

I already search in the internet for result but none of them helped.

Thanks for any help :slight_smile:

Check the events for this for some info you might want to know
https://developer.roblox.com/en-us/api-reference/class/Tool
And at the bottom of this one you get some code to play animations.
https://developer.roblox.com/en-us/api-reference/class/Animation

i know how to detect if player equipped the tool, but how i can change playerโ€™s walking animation.

You load an animation and play it once equipped and maybe have the animation priority above the idle and walk animation

1 Like

thanks ill try that.

Char Limit

So if you look in the characters Animate script. There are TONS of Values with animations in them.

You would have to make a script that does something along these lines:

-- author - @DevKeia @8/31/22

-- for devfourm (made for TheFurukanDev) --

-- The Default Animations, just got them from the character. --
local DefaultAnimationIdle1 = "http://www.roblox.com/asset/?id=2510196951"
local DefaultAnimationIdle2 = "http://www.roblox.com/asset/?id=2510197257"

local DefaultAnimationRun = "http://www.roblox.com/asset/?id=2510198475"

script.Parent.Equipped:Connect(function()
	--// Varibles
	
	-- We are just getting the player --
	local plr = game.Players.LocalPlayer
	local Character = plr.Character
	
	-- Here, we are defining the players animations! --
	local IdleAnim = Character.Animate.idle.Animation1.AnimationId
	local IdleAnim2 = Character.Animate.idle.Animation2.AnimationId
	
	local RunAnimation = Character.Animate.run.RunAnim.AnimationId
	
	-- NOTE: You really don't need to change
	-- The walk animation, no point, your run anim is your walk.
	
	-- Change "Your Animation Id" to the animation ids
	-- Make sure you put an animation into workspace and
	-- Let that define it as an asset, because roblox
	-- Does not know if it is an asset or not.
	
	IdleAnim = "Your Animation Id"
	IdleAnim2 = "Your Animation Id"
	
	RunAnimation = "Your Animation Id"
	
end)

script.Parent.Unequipped:Connect(function()
	--// Varibles
	
	-- Here we are just setting it back --
	
	local plr = game.Players.LocalPlayer
	local Character = plr.Character
	
	local IdleAnim = Character.Animate.idle.Animation1.AnimationId
	local IdleAnim2 = Character.Animate.idle.Animation2.AnimationId

	local RunAnimation = Character.Animate.run.RunAnim.AnimationId
	
	-- Change the varibles at the top if you have custom --
	-- Animations for the idle & the run --
	
	RunAnimation = DefaultAnimationRun
	
	IdleAnim = DefaultAnimationIdle1
	IdleAnim2 = DefaultAnimationIdle2
end)

Did this help?

5 Likes

yes, a lot.

Char Limit

Thanks for giving me a solution!

normally i just ask for the idea that how i can make it, and you gave me the whole script with explaining it, you deserve more :person_shrugging:

haha, thanks! I appreciate it!