I want to check if a animationtrack is loaded and execute this code:
1 | game.Workspace.jumpscares.Noob:SetPrimaryPartCFrame(game.Workspace.animatronicSpawn.CFrame) |
2 | game.Workspace.jumpscares.Noob.HumanoidRootPart.Anchored = true |
3 | wait( 0.19 ) |
4 | player.PlayerGui.scream:Play() |
5 | wait( 1.10 ) |
6 | player.PlayerGui.scream:Stop() |
7 | player.PlayerGui.gameover.Enabled = true |
I already tried using Length and TimePosition but it didn't work.
You could check if a track is loaded by true or false bools?
1 | local animation = --the animation here |
2 | local animationTrack -- We're not going to load the animation just yet... |
3 |
4 | animationTrack = Humanoid:LoadAnimation(animation) --Load the animation somepoint in your code... |
5 |
6 | if animationTrack then --If the animation is loaded then.. |
7 | --do thing |
8 | end |
Sorry if this didn't work!
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.