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

How do I animate a sword from a script?

Asked by
4d0z 4
5 years ago

Hi!

I'm experiencing a problem with my sword's animations.

Here's the localscript:

local Tool = script.Parent;
local click = tick()


Tool.Equipped:connect(function(mouse)
    mouse.Button1Down:connect(function()

        if tick() - click < 0.8 then
        local anim = Instance.new("StringValue")
        anim.Name = "toolanim"
        anim.Value = "Lunge"
        anim.Parent = Tool 
        else
            local anim2 = Instance.new("StringValue")
        anim2.Name = "toolanim"
        anim2.Value = "Lunge"
        anim2.Parent = Tool 
        end
    end)


I'm trying to make it lunge when the player double clicks it and slash when the player clicks one time but no animations happen :(

0
you have to make a new animation, set the animation.id to the correct animation id and then load it into the player humaniod. ( https://developer.roblox.com/api-reference/function/Humanoid/LoadAnimation ) Call :Play() on the item returned by Humaniod:LoadAnimation() Nickiel13 58 — 5y

Answer this question