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

Where would I place LoadAnimation() and Play() in this script?

Asked by 7 years ago

here's the script;

local Punch = script.Parent

function onActivation()
    print("Tool activated")
    wait()
    local Humanoid = Punch.Parent:WaitForChild("Humanoid")
    local CloneAnime = game.ReplicatedStorage.Animation.Humanoid:Clone()
end

Punch.Activated:connect(onActivation)

I just don't know where to place LoadAnimation() then Play(). Please help.

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

You've got most of it right, but one thing - there's no need to clone the animation.

Use the LoadAnimation function on 'Humanoid' after line 7 to retrieve the animation's AnimationTrack . Then use the Play function on the AnimationTrack.

local Punch = script.Parent;
local Animation = game.ReplicatedStorage.Animation;

function onActivation()
    print("Tool activated")
    local Humanoid = Punch.Parent:WaitForChild("Humanoid")
    local anim = Humanoid:LoadAnimation(Animation);
    anim:Play();
end

Punch.Activated:connect(onActivation)
0
what's about teh animation Id? BlackOrange3343 2676 — 7y
0
The AnimationId property should already be set on the Animation in ReplicatedStorage Goulstem 8144 — 7y
0
do I inclue the ;s BlackOrange3343 2676 — 7y
0
semicolons have no syntactical function in Lua. You can go with or without. Goulstem 8144 — 7y
Ad

Answer this question