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:
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!