RoScripter

Menu Gui

Jan 23rd, 2022 (edited)
2,279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. --Place the MenuGui ScreenGui under StarterGui
  2. local Player = game.Players.LocalPlayer
  3.  
  4. local SampleMenuFrame = script.Parent.SampleMenuFrame
  5. local MenuFramesFolder = script.Parent.MenuFrames
  6. local PageLayout = MenuFramesFolder.UIPageLayout
  7.  
  8. SampleMenuFrame.Visible = false
  9.  
  10. --Insert menu categories below using the format provided. Use commas after each item and category.
  11. local MenuCategories = {
  12.     Drinks = {
  13.         "Drink1",
  14.         "Drink2",
  15.     },
  16.     Appetizers = {
  17.         "Appetizer1",
  18.         "Appetizer2",
  19.     },
  20.     Desserts = {
  21.         "Dessert1",
  22.         "Dessert2",
  23.     }
  24. }
  25.  
  26. --Insert the order of your menu categories below using the format provided. Use quotes around each category and insert commas after each.
  27. local MenuCategoriesOrder = {"Drinks", "Appetizers", "Desserts"}
  28.  
  29. for MenuCategory, MenuItems in pairs(MenuCategories) do
  30.     local MenuFrame = SampleMenuFrame:Clone()
  31.     local MenuFrameTitleLabel = MenuFrame.TitleLabel
  32.     local MenuItemsBox = MenuFrame.MenuItemsBox
  33.     local NextButton = MenuFrame.NextButton
  34.     local BackButton = MenuFrame.BackButton
  35.    
  36.     MenuFrame.Parent = MenuFramesFolder
  37.     MenuFrame.Name = MenuCategory
  38.     MenuFrame.LayoutOrder = table.find(MenuCategoriesOrder, MenuCategory)
  39.     MenuFrame.Visible = true
  40.    
  41.     MenuFrameTitleLabel.Text = MenuCategory
  42.    
  43.     for Index, MenuItem in ipairs(MenuItems) do
  44.         MenuItemsBox.Text = MenuItemsBox.Text .. MenuItem .. "\n"
  45.     end
  46.    
  47.     NextButton.MouseButton1Click:Connect(function()
  48.         PageLayout:Next()
  49.     end)
  50.    
  51.     BackButton.MouseButton1Click:Connect(function()
  52.         PageLayout:Previous()
  53.     end)
  54. end
Add Comment
Please, Sign In to add comment