GuiObject:TweenPosition() not working correctly

Hi!

So this error is most likely a very simple solution, I’m not the greatest at UI and have never done UI before this so bear with me…

I’m working on a game UI, I’m using Tweens to smoothly transition to the next section. Here is what is happening:

ePMgQ2vXvr

When clicking on levels, it’s supposed to tween in the levels area. It doesn’t, but what is even weird is while looking at the datamodel while playtesting, the UI is in the right position, but it doesn’t show up!

Here is the code I’m using:

local button = script.Parent
local frame = button.Parent
local menuframe = frame.Parent
local secondmenu = game.StarterGui.MainGUIHandler.BackgroundFrame:WaitForChild("LevelsFrame")
local toggle = false 

secondmenu.Position = UDim2.new(1.5,0,.5,0)

local function onButtonActivated() 
	
	if toggle == false then
		
		menuframe:TweenPosition(UDim2.new(-0.5,0,0.5,0), nil, nil, .5, true)
		print("Should be moving?")
		wait(.6)
		secondmenu:TweenPosition(UDim2.new(0.5,0,0.5,0), nil, nil, .5, true)
		print("SecondAreaDone")
		

		
		
	end
end




button.MouseEnter:Connect(function()
	button.Parent.BackgroundColor3 = Color3.new(0.156863, 0.435294, 0.0392157)
	frame:TweenSize(UDim2.new(0.31833333333, 0,0.13666666666, 0), nil, nil, .2)
end)

button.MouseLeave:Connect(function()
	button.Parent.BackgroundColor3 = Color3.new(0.207843, 0.207843, 0.207843)
	frame:TweenSize(UDim2.new(0.382, 0,0.164, 0), nil, nil, .2)
end)



button.Activated:Connect(onButtonActivated)

Any help would be appreciated! I am new to UI, so this is all very interesting to me. Thanks! :grin:

Try setting the levels area to the position you have it being tweened to in the code while just in edit mode studio and see if it shows up correctly. Maybe you have some other property preventing it from showing correctly (Visible is set to false, ZIndex is behind the background, the levels area is child to some other frame which is still off screen)

2 Likes

Done that, that’s what’s really weird about this.

1 Like

Can you upload the gui somehow? You can copy it over to a blank place if there’s lots of other code and things in the game its currently in

2 Likes

It’s late where I am but I’ll go ahead and DM you the structure of the UI via a .rblx file.

Yeah sounds good. I’ll be able to help you from there