Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
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.

Ad

Answer this question