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

How to make an animation fully load?

Asked by 8 years ago

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 :)

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. EzraNehemiah_TF2 3552 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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()
0
Brilliant idea! Thanks so much :) Florian27 76 — 8y
0
No problem :) Would you mind giving a rep if my answer helped to you? pls? :) superalp1111 662 — 8y
Ad

Answer this question