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

How to get a loaded animation from a Humanoid?

Asked by 5 years ago

Hi! I have 2 functions: One that loads an animation into the humanoid and plays it and one that is supposed to stop playing it. The first function works but I don't know how to stop the animation from playing in the second function: How do you get an animation that has already been loaded into a humanoid?

Script in ServerScriptService:

local function onGlideStartFired(plr)
    local character = game.Workspace:FindFirstChild(plr.Name)
    local humanoid = character:WaitForChild("Humanoid")
    local GlideAnimTrack = humanoid:LoadAnimation(Glide) --here I load the animation
    GlideAnimTrack:Play()
end
local function onGlideStopFired(plr)
    local character = game.Workspace:FindFirstChild(plr.Name)
    local humanoid = character:WaitForChild("Humanoid")
    local GlideAnimTrack = --here I don't know how to get the already loaded animation
    GlideAnimTrack:Stop()
end

Answer this question