#Infinitely Moving SurfaceGui Background

1 messages · Page 1 of 1 (latest)

hybrid osprey
#

Hey everyone!
I'm new to scripting, and I wanted to make some cool animation that uses this Pattern to scroll diagonally, while also being seamlessly infinite(The example gif is also attached). This whole thing is in the SurfaceGui. I went through a lot of Roblox Forums and Youtube videos. Yet i just notice that while being a newbie to scripting I ran into problem that no one really asks for and even might not be supported by Roblox. I tried using ScaleType Tile with RectOffset, but it worked really badly or just starts to stretch until automatically reset.

#

Here is "one" of the codes that performed the best (Origin Code from Roblox Forums/ChatGPT)

local img = script.Parent.Frame.ImageLabel
local offsetx = 0
local offsety = 0
local speed = 5
img.ImageRectSize = Vector2.new(1024, 1024)    
while true do
    offsetx = (offsetx + speed) % img.ImageRectSize.X
    offsety = (offsety + speed) % img.ImageRectSize.Y
    img.ImageRectOffset = Vector2.new(offsetx, offsety)
    task.wait(0.03)
end
still heath
#

because it doesn't seem that the speed/image si,e is increasing