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!
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
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()
YO SICK !!! How do I stop a animation? THANK YOU SO MUCH BTW!
You simply use :Stop() instead of :Play()
YO SICK 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
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
How do you get the feet to like walk with the animation btw?
nvm i got it !!! Its working GREAT!!! THANK YOU
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)
K I GOT knockback + random animations + kills + screen shake + a TON so far so good