Ad
Log in to vote
0

i have finally worked out spritesheets [Free Script]? [closed]

Asked by 11 days ago
Edited 11 days ago

After countless hours of trying to make a animated picture in roblox, I have finally did it! And i'm here to share it with the world and not have others struggle.

Local Script:

--[Step 1]-[Instructions Part 1]--
--Make sure this "Local Script" is inside a ImageLabel or ImageButton.
--Make sure the spritesheet has even amount of sprites in a row (Example: ??[---]  ?[---])
--You may have to mess around with X and Y offset values.       (           [---]    [-- ])
--DO NOT CREDIT THIS AS YOUR OWN WORK, THIS TOOK AGES TO MAKE!

--[Step 2]-[Settings]--
local SpriteSheet = script.Parent --ImageLabel or ImageButton Parent.
local Delay = 0.01 --Delay between each frame (Prefably a lower value).
local OffsetX = 48 --The amount of pixels needed to move to the next frame. [X]
local OffsetY = 57 --The amount of pixels needed to move to the next frame. [Y]
local RowAmount = 4 --How many sprites in a each row. (Example: [-----] There are 5 sprites in a row)
local ColummAmount = 14 --How many Collums are there.  (Example: [---] There are 2 collums)
local Looped = true --If wanted to be looped           (         [---]                    )

--[Step 3]-[Instructions Part 2]--
--Set the image to the spritesheet
--Set the Image size as big as a single sprite of the sheet (The example charmander is 0,48, 0,57)
--Set the ImageRectOffset to the size of a single sprite of the sheet.
--Make sure that ImageRectOffset is 0,0
--Change the transparency if you wan't to.

--[SCRIPT]-[DON"T EDIT]--
wait(1)
while true do
    wait(0.01)
    for i =1,ColummAmount do
        for i =1,RowAmount do
            wait(Delay)
            local x = SpriteSheet.ImageRectOffset.X
            local y = SpriteSheet.ImageRectOffset.Y
            wait(0.01)
            SpriteSheet.ImageRectOffset = Vector2.new(x+OffsetX,y)
        end
        local x = SpriteSheet.ImageRectOffset.X
        local y = SpriteSheet.ImageRectOffset.Y
        wait(0.01)
        SpriteSheet.ImageRectOffset = Vector2.new(0,y+OffsetY)
    end
    SpriteSheet.ImageRectOffset = Vector2.new(0,0)
end

--[Extra]-[Help]--
--Use: "https://ezgif.com/gif-to-sprite" to make a spritesheet!

--ZombaScripts GIF maker.

HAVE FUN!

Test Place: https://www.roblox.com/games/2626093973/spritetest

0
Very interesting. Thanks for your hard work. RBLXHS 7 — 11d
0
Thanks. ZombaScripts 79 — 11d
0
you post questions here, not your creations. post this in Cool Creations inside the forum EXpodo1234ALT 1101 — 11d

Closed as off-topic by EXpodo1234ALT, zblox164, and yHasteeD

This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.

Why was this question closed?