How To Make This Weapon Smoother?

Hey guys, I’m making a battle axe, but I’ve noticed that it is quite weird in what it does and it just doesn’t feel smooth. Here is a video of me swinging it:
robloxapp-20200815-1506186.wmv (1.3 MB)

MY CODE:

local animations = {"3208682938","3352120414","3363060046"} -- put ur animation ids here
local CanAttack = true

script.Parent.Activated:Connect(function()
if CanAttack == true then
script.Parent.CanDamage.Value = true
local animation = Instance.new("Animation",  script.Parent.Parent)
animation.AnimationId = "http://www.roblox.com/asset?id="..animations[math.random(1, #animations)]
local chosenanim = script.Parent.Parent.Humanoid:LoadAnimation(animation)
chosenanim:Play()
CanAttack = false
wait(1)
CanAttack = true
script.Parent.CanDamage.Value = false
end
end)

Thanks!

2 Likes

You see how the animations doesn’t return to its original spot, that might be why. It would be best to make add a return to original spot on your current animation. I’m not an expert at this but what’s what I would do.

2 Likes

What do you mean by “doesn’t match”?

1 Like

Re-read it, I just rephrase it lol.

2 Likes

I would suggest that you indent your code so that it’s more readable.

Also I think it would help to wait until the animation is over, so you can do something like:

chosenanim:Play()
CanAttack = false
wait(chosenanim.Length)
CanAttack = true

This way it will wait until the animation is over, and the player will only be able to activate the weapon after the animation has finished playing.

Hopefully this helps

1 Like