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

Problems with Animations in a Tool doesn't seem to work?

Asked by
Nozyfo 2
4 years ago

So basically I was making a mmorpg game like sword burst 2 but it's a village with Dragon, I was trying to make a Animations in a Tool like running animation while holding it and idle and so much more but there's a problem cause it doesn't seem to work i copied a tutorial on YouTube here's the link (https://youtu.be/jr6dRmaj6xI) but it doesn't seem to work i tried everything, If anyone could help me please reply here asap, Thank you!

0
Can you please provide your code, so this question doesn't get moderated Cynical_Innovation 595 — 4y
0
I can't answer the question without code to start off with. CrastificeDude612 71 — 4y
0
I can't answer the question without code to start off with. CrastificeDude612 71 — 4y
0
I can't answer the question without code to start off with. CrastificeDude612 71 — 4y
View all comments (3 more)
0
Sorry, that was a glitch. CrastificeDude612 71 — 4y
0
Can you please accept my answer if it works? It said you did, but I didn’t get any rep Cynical_Innovation 595 — 4y
0
yes it works but idk how do i add a running animation into it I'll send the code in an hour sorry Nozyfo 2 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

TO play an animation, you need to load it into a humanoid. I didn't bother watching the video you showed, so if this isn't what you're looking for, then welp.

local player = game.Players.LocalPlayer

script.Parent.Activated:Connect(function() --//Plays the animation every time a player clicks with the tool equipped
    local anim = player.Character.Humanoid:LoadAnimation(script.Parent.Animation)
    anim:Play()
end)

Basically, to play an animation you do:

local player = game.Players.LocalPlayer

local anim = player.Character.Humanoid:LoadAnimation(script.Parent.Animation)
anim:Play()
0
on idle animation tho? i have this at idle animation Nozyfo 2 — 4y
Ad
Log in to vote
0
Answered by
Nozyfo 2
4 years ago
local Tool = nil
local AnimScript = nil
script.Parent.Equipped:Connect(function()
    Tool = script.Parent
    AnimScript = Tool.Parent:WaitForChild("Animate")
    AnimScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
    AnimScript.toolnone.ToolNoneAnim.AnimationId = "rbxassetid://5283297823"
end)
script.Parent.Unequipped:Connect(function()
    AnimScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
    AnimScript.toolnone.ToolNoneAnim.AnimationId = "rbxassetid://"
end)

Answer this question