TweenPosition UI not working when calling from a variable

Hello! I have been lately trying to create so a frame can have two images move together in sync.

There’s an issue that seems like I cannot call a variable that I made when I use TweenPosition. I can however create two scripts to have script.parent but sometimes it goes out of sync and It won’t come back to where it used to be or come in at a weird timing over a certain period of time.

I don’t see any solutions on developer hub or anywhere else like on devforum, I tried using two scripts but that got the images out of sync and I also tried removing the wait time but that just got the image removed from the StarterGui nowhere to be seen. So If any could tell me what is it that I’m doing wrong I would be grateful. Thank you.

local Slide = game.StarterGui.Shop.Frame.Images.Pics.image
local Slide2 = game.StarterGui.Shop.Frame.Images.Pics.image2

wait(5)
Slide:TweenPosition(UDim2.new(1,0,0,0),"Out","Quad",0.1)
print("Check if Img moved.")
local Slide = script.Parent:WaitForChild("Slide")
local Slide2 = script.Parent:WaitForChild("Slide2")

task.wait(5)
Slide:TweenPosition(UDim2.new(1,0,0,0),"Out","Quad",0.1)
print("Check if Img moved.")

Place this inside the instance in StarterGui of which the 2 slide instances are also inside of.

Should look like this:

image

1 Like

The ui on the screen is in playergui not startergui

Ah, ok. Thank you, I’ll correct it.

Ah, Thank you very much. It solved the issue for me. :slight_smile: