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

How do I get my sword to work with an animation for it?

So i made a lightsaber and a animation for a attack. I have everything set like the Value, script, local script, and the weld script. I put the animation into my local script. This is my what my local script says.

local CanAttack = true

script.Parent.Activated:connect(function() local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)

if CanAttack == true then attack:Play() CanAttack = false wait(1) attack:Stop() CanAttack = true script.Parent.CanDamage.Value = true end end)

So when i go to test it everything works but theirs this one problem. The animation will play when i click with the lightsaber but the lightsaber wont move with it, it just stays in its normal position while the other side of my person is moving. I am also using R15 and the animation is R15. So please help.

2 comments

0

Code block, please

0

I'm clueless of how to code block.

1 answer

I think it has to go something along the lines of this:

local animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
animation:Play()

3 comments

0

Didn't work.

0

is the script.Attack classname an animation?

0

Attack is the name of the animation.

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