Hey! I’m trying to make a menu GUI where you can navigate through a few different subGUIs. I got that far, but now that I’m trying to make it pretty with tweening I am running into trouble.
As an example of what I’m trying to accomple, say I click on “LEVEL UP”
I want that to make the level up GUI visible:
and then tween out to the proper position:
Here’s the code I wrote trying to achieve this:
LvlUpButton.MouseButton1Click:Connect(function()
print("1st")
if mainFrame.Position == UDim2.new(0.298, 0, 0.223, 0) then
print("2nd")
mainFrame.Visible = true
mainFrame:TweenPosition(UDim2.new(0.436, 0, 0.223, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,1)
elseif mainFrame.Position == UDim2.new(0.436, 0, 0.223, 0) then
print("3rd")
mainFrame:TweenPosition(UDim2.new(0.298, 0, 0.223, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,1)
mainFrame.Visible = false
end
end)
with mainFrame being the LevelUpGUI. This is in a local script under a general screenGUI that encompasses everything on the screen. For some reason this only prints “1st” and gets no further. I have double checked that the frame is in the right initial position (0.298,0,0.223,0) but no luck.
I’m still very new to coding (this is my first game ) so it’s very likely that this will just be something simple that I overlooked. Let me know if you need to see anything else!
Thanks for any help!