Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Using 2 image labels to look like a moving looping Gui. Randomly stops at times?

2 ImageLabels called Polkadots & Polkadots2 are in a while loop that tweens them for 10 seconds then teleports them back to their original position and then tweens again for 10 seconds. Polkadots moves offscreen and Polkadots2 moves onscreen. Both are identical so you cant tell when they've been repositioned.

Problem is they sometimes stop moving for no reason at all for as long as the tween time and I don't know what to do about it. Help would be nice.

local PolkaDots = script.Parent.Parent:WaitForChild("BackgroundFrame"):WaitForChild("PolkaDots")--Gets the first image
local PolkaDots2 = script.Parent.Parent:WaitForChild("BackgroundFrame"):WaitForChild("PolkaDots2")--Gets the second one

local TweenTime = 10

while true do
	PolkaDots:TweenPosition(UDim2.new(-1,0,0,0),0,0,TweenTime)--Moves offscreen
	PolkaDots2:TweenPosition(UDim2.new(0,0,0,0),0,0,TweenTime)--Moves onscreen
	wait(TweenTime)--Waits for as long as they tween
	--print("changing position")
	PolkaDots.Position = UDim2.new(0,0,0,0)--Teleports them back to original position after tweentime
	PolkaDots2.Position = UDim2.new(1,0,0,0)
end

How it looks (Forget the other Gui's. It's just the background that matters)

1 answer

local PolkaDots = script.Parent.Parent:WaitForChild("BackgroundFrame"):WaitForChild("PolkaDots")--Gets the first image
local PolkaDots2 = script.Parent.Parent:WaitForChild("BackgroundFrame"):WaitForChild("PolkaDots2")--Gets the second one

local TweenTime = 10

while true do
    PolkaDots:TweenPosition(UDim2.new(-1,0,0,0),0,0,TweenTime,true)--Moves offscreen
    PolkaDots2:TweenPosition(UDim2.new(0,0,0,0),0,0,TweenTime,true)--Moves onscreen
    wait(TweenTime)--Waits for as long as they tween
    --print("changing position")
    PolkaDots.Position = UDim2.new(0,0,0,0)--Teleports them back to original position after tweentime
    PolkaDots2.Position = UDim2.new(1,0,0,0)
end

You would add true to make it over writable so when one is moving the other can override.

This discussion is preserved as it was. New answers, comments, and votes are closed.