Why aren't these pages in my GUI tweening correctly?
In my GUI, I'm creating pages in my menu for the players to see more things about the game. Unfortunately I've tried my best and nothing seems to be working. I'm not sure if I'm tweening the pages incorrectly or maybe it could be the positioning? I'm not sure, any thoughts? The only thing that seems to be working is scrolling down the pages, scrolling back up is where it breaks and shows nothing. (The silly keywords, such as "cheese" or "depression", are tags for the levels in the game, if that throws anyone off)
003 | cheese = UDim 2. new( 0.100000001 , 0 , 0.100000001 , 0 ) |
004 | depression = UDim 2. new( 2 , 0 , 0.100000001 , 0 ) |
005 | driving = UDim 2. new( 3 , 0 , 0.100000001 , 0 ) |
006 | thousand = UDim 2. new( 4 , 0 , 0.100000001 , 0 ) |
007 | rub = UDim 2. new( 5 , 0 , 0.100000001 , 0 ) |
008 | function TweenPageTo(page,pos) |
009 | page:TweenPosition(pos, "Out" , "Back" ,. 75 , true , nil ) |
011 | function SetPageTo(page,pos) |
017 | for i,v in pairs (script.Parent:GetChildren()) do |
018 | if v.Name:sub( 1 , 4 ) = = "Page" then |
025 | if pagenow<#CountPages() then |
026 | return script.Parent [ "Page" .. pagenow+ 1 ] |
033 | return script.Parent [ "Page" .. pagenow- 1 ] |
039 | script.Parent.Frame.NextPage.MouseButton 1 Down:connect( function () |
044 | TweenPageTo(script.Parent [ "Page" .. pagenow ] ,depression) |
045 | nextpage.Visible = true |
046 | SetPageTo(nextpage,driving) |
047 | TweenPageTo(nextpage,cheese) |
049 | script.Parent [ "Page" .. pagenow ] .Visible = false |
055 | script.Parent.Frame.PrevPage.MouseButton 1 Down:connect( function () |
060 | TweenPageTo(script.Parent [ "Page" .. pagenow ] ,driving) |
061 | prevpage.Visible = true |
062 | SetPageTo(prevpage,depression) |
063 | TweenPageTo(nextpage,thousand) |
065 | script.Parent [ "Page" .. pagenow ] .Visible = false |
071 | script.Parent.Frame.PrevPage.MouseButton 1 Down:connect( function () |
076 | TweenPageTo(script.Parent [ "Page" .. pagenow ] ,thousand) |
077 | prevpage.Visible = true |
078 | SetPageTo(prevpage,driving) |
079 | TweenPageTo(nextpage,rub) |
081 | script.Parent [ "Page" .. pagenow ] .Visible = false |
087 | script.Parent.Frame.PrevPage.MouseButton 1 Down:connect( function () |
092 | TweenPageTo(script.Parent [ "Page" .. pagenow ] ,rub) |
093 | prevpage.Visible = true |
094 | SetPageTo(prevpage,thousand) |
095 | TweenPageTo(prevpage,cheese) |
096 | TweenPageTo(prevpage,depression) |
097 | TweenPageTo(prevpage,driving) |
099 | script.Parent [ "Page" .. pagenow ] .Visible = false |