hello guys, i have a script that plays anims on meshes and it works but i want it to play after delays but the script just plays continiously without a stop regardless of adding wait, is their any fixes?
local char = script.Parent
local animController = char:FindFirstChild("Humanoid") or char:FindFirstChildOfClass("AnimationController")
local animation1 = script.Charge
local animation2 = script.GoingShoot
local animation3 = script.Shoot
local animTrack1 = animController:LoadAnimation(animation1)
local animTrack2 = animController:LoadAnimation(animation2)
local animTrack3 = animController:LoadAnimation(animation3)
animTrack1:Play(0,1,1)
animTrack2:Play(0,1,1)
animTrack3:Play(0,1,1)
Can you elaborate more on the delay you want to add?
Does the delay vary? Is it something related to user inputs? What is your goal with adding the delays?
if the animation is “playing endlessly”, ensure that when you export your animation Looped is set to disabled, otherwise set that property to false per animation.
As far as delays go, you could try the task.delay function to see if it’s closer to a resolution you’re looking for.
If you want an endless loop, you can make use of a while do loop.
while true do
--animation1
--task.wait(<any delay you want in between the animations>)
--other animations
task.wait(10) --the by you mentioned wait time between loops
end
This should in theory run forever. If you want to be able to pause the loop (optimization sake), you can make a local variable and use a repeat until to make it break the loop.
Example of the repeat loop
local loopAnimation = true
repeat
--animations with or without delays inbetween
until loopAnimation == false