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

How do I detect when the animationtrack is loaded?

Asked by 4 years ago
Edited 4 years ago

I want to check if a animationtrack is loaded and execute this code:

game.Workspace.jumpscares.Noob:SetPrimaryPartCFrame(game.Workspace.animatronicSpawn.CFrame)
game.Workspace.jumpscares.Noob.HumanoidRootPart.Anchored = true
wait(0.19)
player.PlayerGui.scream:Play()
wait(1.10)
player.PlayerGui.scream:Stop()
player.PlayerGui.gameover.Enabled = true

I already tried using Length and TimePosition but it didn't work.

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You could check if a track is loaded by true or false bools?

local animation = --the animation here
local animationTrack -- We're not going to load the animation just yet...

animationTrack = Humanoid:LoadAnimation(animation) --Load the animation somepoint in your code...

if animationTrack then --If the animation is loaded then..
    --do thing
end

Sorry if this didn't work!

Ad
Log in to vote
-1
Answered by
Necro_las 412 Moderation Voter
4 years ago

You can use GetPlayingAnimationTracks as explains here:

https://developer.roblox.com/en-us/api-reference/function/Humanoid/GetPlayingAnimationTracks

or you can store the loaded animations in a table so you can check it latter.

0
The animation is still delayed. VitGamer123br 32 — 4y

Answer this question