I am working on a menu that when it transitions from different screens, the buttons tween off screen, change the text, and then tween back on screen. The only problem is that the buttons don’t come back and I have no clue to why. If anyone knows what my problem is, can you show me how to fix it? Thanks!
Here is my code:
function fade(out) -- out: If to tween off screen = true, to tween on screen = false
local mainbuttontweendelay = 0.3 -- Duration of the tween
local pos = { -- Just the tween info. I thought this was the problem, but I don't believe so...
botmainbuttonsout = UDim2.new(-1, 0, 0.6, 0),
botmainbuttonsin = UDim2.new(0, 0, 0.6, 0),
mainbuttontweenstyle = Enum.EasingDirection.In, Enum.EasingStyle.Sine, mainbuttontweendelay
}
if out == true then -- Tween off screen
bot:TweenPosition(pos.botmainbuttonsout, pos.mainbuttontweenstyle) -- Tween Bottom Button off screen(Works)
wait(mainbuttontweendelay)
elseif out == false then -- Tween in to screen
bot:TweenPosition(pos.botmainbuttonsin, pos.mainbuttontweenstyle) -- Tween Bottom Button on screen(Does not work), I put prints before and after this line and both fired, but it still did not tween
wait(mainbuttontweendelay)
end
end
function topclicked()
if running == false then -- So multiple functions don't get fired at once
running = true
fade(true) -- Bottom button should tween off screen(Works)
bot.DisplayLabel.Text = "Back" -- Change text of bottom button(Works)
fade(false) -- Bottom button should tween back on screen(Does not work)
wait(rundelay)
running = false
end
end
NOTE: I edited my code above to shorten it.