Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Sword animation script not working?

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

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)

4 comments

0

No, when its activated

0

What does activated mean?

0

when you equip it and then you click. like tool.Activated:connect(function()

0

Ok let me fix this. By the way there's no activated event.

This discussion is preserved as it was. New answers, comments, and votes are closed.