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

Why won't my animation play [BUMP]?

Asked by 10 years ago

I'm not sure if I will get in trouble for posting because no one is answering on my first attempt. After some help from a few people (Big help form Redbullusa), we have come up with this script:

char = game.Players.LocalPlayer.Character
humanoid = char:WaitForChild("Humanoid")

-- You may delete the first two lines if they're already defined.
-- Be sure to replace the 'humanoid' variable to the desired Humanoid object in line 11 if you do.

SlashAnim = Instance.new("Animation")
SlashAnim.Name = "toolanim"
SlashAnim.AnimationId = "http://www.roblox.com/asset/?id=211308302"
SlashAnim.Parent = Tool
SlashAnimLoaded = humanoid:LoadAnimation(SlashAnim)

function attack()
    damage = slash_damage
    SlashSound:play()
    SlashAnimLoaded:Play()
end

It is in the default LinkedSword gear SwordScript. Tgis is the only modification in the script. Everything works very well accept one thing; The animation won't play! Here is the Animation on the site: http://www.roblox.com/Wrench-Swing1-item?id=211308302 The animation is a simple sword slash but is customized by me to swing at an angle. The priority is an action. It is not looped.

Any help?

~Minikitkat

1 answer

Log in to vote
0
Answered by 10 years ago

Everything besides not calling the function is fine. Functions do not run the code inside unless they are called, as so;

char = game.Players.LocalPlayer.Character
humanoid = char:WaitForChild("Humanoid")

-- You may delete the first two lines if they're already defined.
-- Be sure to replace the 'humanoid' variable to the desired Humanoid object in line 11 if you do. 

SlashAnim = Instance.new("Animation")
SlashAnim.Name = "toolanim"
SlashAnim.AnimationId = "http://www.roblox.com/asset/?id=211308302"
SlashAnim.Parent = Tool
SlashAnimLoaded = humanoid:LoadAnimation(SlashAnim)

function attack()
    damage = slash_damage
    SlashSound:play()
    SlashAnimLoaded:Play()
end

attack()
Ad

Answer this question