Idle Punch Animation Simple

How do i make it so that if a player equips a tool their fists go up like they are ready to punch? Does it involve animations? Thanks! :smiley:

1 Like

yes it does! just animate an idle animation for whenever the player equips the tool (may be better to make it looped) and make the animation stop when they un-equip the tool

1 Like

I see!!! So like I change their animation id? Or is there a way to like start a animation while its active because I know if you change their id they have to stop and start again for it to activate.

something like

local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)

Or what is the code? XD sorry I’ve jsut never made a punch tool before!

You can use

Tool.Equipped:Connect(function())
-- Code 
End)

to detect when the player equips the tool
and

Tool.Unequipped:Connect(function())
-- Code 
End)

if you want to detect when they unequip it

As for the animations…

First you want to make your animation (Ignore steps 1,2 if you already made the instance manually)

1 - make your animation instance
Anim = instance.new(ā€œAnimationā€)

2 - Apply the animation ID
Anim.AnimationId = – Your id

(Remember to also set a Parent for the animation!)

3 - Get the animator, it should be within the humanoid of the player, make sure to use WaitForChild or FindFirstChild depending on your case

Animator - Humanoid:FindFirstChild(ā€œAnimatorā€)

4 - Load the animation
PunchIdle = Animator:LoadAnimation(ā€œAnimā€)

5 - play the animation
PunchIdle:Play()

1 Like

YO SICK :smiley: !!! How do I stop a animation? THANK YOU SO MUCH BTW! :smiley:

You simply use :Stop() instead of :Play()

YO SICK :smiley: Lemme test it!! Ill send you a vid if it works (:

i’ve made my own version just now, it works fine!
Result: https://gyazo.com/336185c8cd362f11a6cb4881179e9830

Script:

tool = script.Parent.Parent
tool.Equipped:Connect(function()
	local char = script.Parent.Parent.Parent
	local plr = game.Players:GetPlayerFromCharacter(char)
	local hum = char:FindFirstChild("Humanoid")
	
	--making the anim
	local Anim = Instance.new("Animation",char)
	Anim.AnimationId = "rbxassetid://7346783493"
	
	local Animator = hum:FindFirstChild("Animator")
	local PunchIdle = Animator:LoadAnimation(Anim)
	PunchIdle.Looped = true

	PunchIdle:Play()
	
	tool.Unequipped:Connect(function()
		PunchIdle:Stop()
		Anim:Destroy()
	end)
end)

(It’s better to learn off it, use the script as an example for the things i told you)
hope this helped :wink:

2 Likes

YO THANK YOU SO MUCH, Btw i will give u creds in my game desc. I hope it gets 1m visits hopefully but we will see XD. Its still beta btw (::, hey maybe youll be famous just for helping out a fellow robloxian XD

2 Likes

How do you get the feet to like walk with the animation btw? :smiley:

nvm i got it :smiley: !!! Its working GREAT!!! THANK YOU :smiley:

if you want the legs to move normally, then don’t animate the legs in the animaton (in my idle animation i animated them when the player stands still so they should still move normally when people walk)

1 Like

K I GOT knockback + random animations + kills + screen shake + a TON :smiley: so far so good :smiley: