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

Sword animation script not working?

Asked by 9 years ago

A simple animation script for my sword isn't working. This is a localscript.

Script:

tool = script.Parent
player = script.Parent.Parent.Parent
Humanoid = player.Character.Humanoid

script.Parent.Activated:connect(function(hit)
    local animation = Instance.new("Animation")
    animation.AnimationId = "http://www.roblox.com/Asset?ID=217206026"
    local animTrack = Humanoid:LoadAnimation(animation)
    animTrack:Play()
end)

1 answer

Log in to vote
0
Answered by
yoshiegg6 176
9 years ago

Ok, I think I fixed it.

tool = script.Parent
player = game.Players.LocalPlayer.Character
Humanoid = player.Humanoid

tool.MouseButton1Down:connect(function()
if tool.Equipped = true then
    local animation = Instance.new("Animation")
animation.Parent = player
    animation.AnimationId = "http://www.roblox.com/Asset?ID=217206026" --Make sure this is one of your own animations, you can't play other people's because roblox doesn't allow it.
    local animTrack = Humanoid:LoadAnimation(animation)
    animTrack:Play()
end)
0
No, when its activated Operation_Meme 890 — 9y
0
What does activated mean? yoshiegg6 176 — 9y
0
when you equip it and then you click. like tool.Activated:connect(function() Operation_Meme 890 — 9y
0
Ok let me fix this. By the way there's no activated event. yoshiegg6 176 — 9y
Ad

Answer this question