SpriteSheet on Event!

Quite simple! Check out this post! It shows how to make a GIF using sprite sheets, but what I need help with is how would I make it so it animates on function, example if I fire a remoteEvent I want it so it plays the spritesheet and then ends, any ideas how to achieve this effect?

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()
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.