Assuming you are using the default script giving in the link, you wanna make a connection to the Run Service function.
“con, short for connection”
local con = function() – but to runService function
So basically
local RunS = game:GetService("RunService")
local animateSprite -- Connection (default = nil/false)
-- Other code in Middle (warperFramerate,etc.)
local function playSprite() -- under UpdateWarper
if animateSprite then animateSprite:Disconnect(); animateSprite = nil end -- if already connected reset
animateSprite = RunS.RenderStepped:Connect(function() -- set up con = funcction()
UpdateWarper(AnimationFunction)
end)
end
local function stopSprite()
if animateSprite then animateSprite:Disconnect(); animateSprite = nil end -- basically reset
end
task.wait(2)
playSprite()
task.wait(4)
stopSprite()