roblox spirtesheet code example

Example: roblox sprite sheet player

local imagewidth = 2256
local imageheight = 752
local rows = 4
local columns = 12
local spritewidth = imagewidth/columns
local spriteheight = imagewidth/rows

--This should be the relevant image label.
--The image label should be imagewidth * imageheight
--and embedded into a frame that is the size of one sprite
--the frame should have clips descendents on

local imagelabel

--Replace this with a relevant loop structure
while looping do
	for row = 0, rows do
		for column = 0, columns do
			local offset = UDim2.new(0, spritewidth*column, 0, spriteheight*row)
			sprite.Position = offset
			--Some kind of delay goes here. If you're using a while loop a wait
			--is probably what you want
			wait()
		end
	end
end

Tags:

Misc Example