Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make an animation fully load?

So, whenever I this animation is played on the player the first time it won't work. Then you have to wait like 2 seconds and click it for it to officially fully work. How do you make the animation work on the first time?

All my animations are stored in StarterGui, then cloned into the player.

local s = script.Parent
local player = game.Players.LocalPlayer

local anim1 = script:WaitForChild("Backflip")

local enabled = true

local backflip = s.Button

backflip.MouseButton1Down:connect(function()
if enabled then
   enabled = false

local animationTrack = player.Character.Humanoid:LoadAnimation(anim1)
animationTrack:Play()

wait(1)
enabled = true
end
end)

Thanks so much if you helped :)

1 comment

0

I'm guessing that it's because you're using a local script. Local scripts run before the server starts therefore you run the script before your character loads. Try waiting a few seconds then click the button. Tell us the results.

1 answer

✓ Accepted answer

You can play all the animations on a bot each time a player gets in the game, so it will be loaded for player. You can play an animation on a bot by using an AnimationController. Here's an example which you can find in Wiki

local animController = Instance.new("AnimationController")
local animTrack = animController:LoadAnimation(animation)
animTrack:Play()

2 comments

0

Brilliant idea! Thanks so much :)

0

No problem :) Would you mind giving a rep if my answer helped to you? pls? :)

This discussion is preserved as it was. New answers, comments, and votes are closed.