Community Resource 1 | Image Slideshow | Zephyra Studios

Hello all! Zephyra Studios is now presenting you guys with some resources we make to give some free to use assets to the community.

Resource Number 1

|

Image Slideshow

local images = {script.Parent.Background1, script.Parent.Background2} -- Referencing both image labels
local blackOverlay = script.Parent.BlackOverlay -- Reference to the black overlay frame
local fadeDuration = 1.5 -- Increased duration for a subtler fade effect
local currentIndex = 1 -- Start with the first image

-- Function to handle fading
local function fade(imageLabel, startAlpha, endAlpha, duration)
    local step = (endAlpha - startAlpha) / (duration * 60) -- Assuming 60 frames per second
    for alpha = startAlpha, endAlpha, step do
        imageLabel.ImageTransparency = alpha
        blackOverlay.BackgroundTransparency = 1 - endAlpha -- Fade the overlay to completely black
        wait(1/60) -- Wait for the next frame (60 FPS)
    end
    imageLabel.ImageTransparency = endAlpha -- Ensure it ends at the correct value
    blackOverlay.BackgroundTransparency = 1 -- Ensure overlay is fully black at the end of the fade
end

while true do
    -- Make the overlay visible for the fade effect
    blackOverlay.Visible = true
    blackOverlay.BackgroundTransparency = 0 -- Ensure the overlay is fully opaque
    fade(images[currentIndex], 0, 1, fadeDuration) -- Fade out the current image

    -- Switch visibility
    images[currentIndex].Visible = false

    -- Update index to the next image (1 -> 2, 2 -> 1)
    currentIndex = currentIndex == 1 and 2 or 1

    -- Switch visibility for the new current image
    images[currentIndex].Visible = true

    -- Fade from black (overlay)
    fade(images[currentIndex], 1, 0, fadeDuration) -- Fade in the new image
    blackOverlay.Visible = false -- Hide the overlay after fading in

    wait(5) -- Wait for 5 seconds before switching again
end


Short Video Representation

|

Click Here - Streamable


On Your End

sss

  1. Create a ScreenGui and name it however you’d like

  2. Create a Frame and name it however you’d like

  3. Add in 2+ ImageLabels and put in their images, and name them however you’d like, just be sure to set that value in the script

  4. Add in a LocalScript and name it however you’d like, and copy the script above and paste it inside of the script


These scripts are some scripts that will be used in the development of our game, use them as you please, no credit is needed. Come back next time! Thank you! :smiley:

1 Like