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

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

Asked by 7 years ago
Edited 7 years ago

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.

0
Code block, please Thundermaker300 554 — 7y
0
I'm clueless of how to code block. Dr_Beefy 0 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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

local animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
animation:Play()
0
Didn't work. Dr_Beefy 0 — 7y
0
is the script.Attack classname an animation? rareheaddress 74 — 7y
0
Attack is the name of the animation. Dr_Beefy 0 — 7y
Ad

Answer this question