Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make an idle stance for tools?

Asked by 6 years ago

I'm working on a few games, but I can't figure out how to make idle stances for swords/bows, or other things like that. If I'm breaking any rules please notify me, I just signed up on SH.

And also I need help with animating, whenever the player walks with my custom animation, it plays then stops and they are frozen in the animation. If you don't understand please reply asking for my discord. Thanks.

Crxstak | Ignited_Spark

P.S I know that I need to post code I have trouble with, but I have no code :(

1 answer

Log in to vote
1
Answered by 6 years ago

So, what you can do is when a player equips a tool, it plays an animation. This animation priority should be idle, and it should be looped.

Here is how you get an animation to play when you equip a tool:

--this is assuming the script is in the tool

local anim = nil --this is nil for now.

script.Parent.Equipped:connect(function()
    anim = script.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(script.idle) --make the animation in the script, and make it called "idle"
    anim:Play()
end)

Better example here:

http://wiki.roblox.com/index.php?title=API:Class/Humanoid/LoadAnimation

To make it stop, just do this:

--this is adding on to the previous script

local anim = nil --this is nil for now.

script.Parent.Equipped:connect(function()
    anim = script.Parent.Parent:FindFirstChild("Humanoid"):LoadAnimation(script.idle) --make the animation in the script, and make it called "idle"
    anim:Play()
end)

script.Parent.Activated:connect(function()
    --code
end)

Make sure you set priorities with animations.

Here is the priority guide:

http://wiki.roblox.com/index.php?title=API:Enum/AnimationPriority

(It's an option in the animaton editor, don't worry)

If this helped, please accept the answer. If it didn't comment on this!

0
Hey thanks alot, but please tell me where to put these scripts, in StarterPlayer, or whatever?? Thanks alot Ignited_Spark -5 — 6y
0
oh god, sorry for late reply. In the tool. MakeYourEscape 334 — 6y
Ad

Answer this question