Advertisement
Guest User

For Oseday

a guest
Apr 9th, 2020
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.63 KB | None | 0 0
  1. -- Path to the PlayerGui, waits for PlayerGui to be created
  2. local PlayerGui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
  3. -- Path to the service that detects which keys are pressed
  4. local UserInputService = game:GetService("UserInputService")
  5. -- Path to target working directory of the entire project, waits for the entire GUI to load?
  6. local TWD = PlayerGui:WaitForChild("DockyardTerminalDemo")
  7. -- Path to target working directory of a specific function
  8. local dockyardTerminalTWD = TWD.DockyardMain.Container.TopBar
  9. -- The Parent frame containing all of the objects we will be modifying
  10. local dockyardTerminalMainFrame = TWD.DockyardMain
  11. -- The Title displayed on the target frame
  12. local dockyardTerminalTitle = dockyardTerminalTWD.TitleLabel
  13. -- The subtitle text contained on the frame on the screen
  14. local dockyardTerminalSubtitle = dockyardTerminalTWD.PageSubtitle
  15. -- The button we will use to change the text displayed on the topbar
  16. local dockyardTerminalBackButton = dockyardTerminalTWD.BackToHome
  17. -- The button we will used to exit the GUI
  18. local dockyardTerminalExitButton = dockyardTerminalTWD.ExitTerminal
  19. -- A list that stores the keys used in stringDictionary
  20. local stringTableKeysArray = {"Oseday", "Nevs", "Cameron", "Sanddog"}
  21.  
  22. -- Initialize a dictionary to hold string values tied to their respective keys     
  23. local stringDictionary = {}
  24.  
  25. -- Not the conventional way to generate several dict items but I couldn't get it to accept string keys
  26. stringDictionary["Oseday"] = "yo guys halp find who she is"
  27. stringDictionary["Nevs"] = "Oseday I told you I could figure this shit out dawggg"
  28. stringDictionary["Cameron"] = "il ve og ib 5"
  29. stringDictionary["Sanddog"] = "HES GOING FOR THE LONG THROW PASS!!!!!!!!!!!!!!!!!!!"
  30.  
  31.  
  32. local stringIteration = 1
  33. local frameEnabled = false
  34.  
  35. -- The 'F' key
  36. local fKey = Enum.KeyCode.F
  37.  
  38.  
  39. -- First lets try to change the title text on the topbar just for the heck of it
  40. PlayerGui.DockyardTerminalDemo.DockyardMain.Container.TopBar.TitleLabel.Text = stringTableKeysArray[stringIteration]
  41.  
  42.  
  43. -- Changes the Title and Subtitle of the dockyard terminal topbar when the back button is pressed
  44. function backButtonOnPressed()
  45.     if stringIteration == 4 then
  46.         -- Reset the key to the first item in the list
  47.         stringIteration = 1
  48.         -- Update the text title and subtitle
  49.         dockyardTerminalTitle.Text = stringTableKeysArray[stringIteration]
  50.         dockyardTerminalSubtitle.Text = stringDictionary[stringTableKeysArray[stringIteration]]
  51.     else
  52.         -- Advance to the next key
  53.         stringIteration = stringIteration + 1
  54.         -- Update the text title and subtitle
  55.         dockyardTerminalTitle.Text = stringTableKeysArray[stringIteration]
  56.         dockyardTerminalSubtitle.Text = stringDictionary[stringTableKeysArray[stringIteration]]
  57.     end
  58. end
  59.  
  60.  
  61. -- Sets the dareglass window to inactive
  62. function exitButtonOnPressed()
  63.     if TWD.Enabled == true then
  64.         frameEnabled = false
  65.         TWD.Enabled = false
  66.     end
  67. end
  68.  
  69.  
  70. -- Allows the player to activate the frame with the F key
  71. function enableFrame(input, gameProcessedEvent)
  72.     if isKeyPressedF() == true then
  73.         if frameEnabled == false then
  74.             frameEnabled = true
  75.             TWD.Enabled = true
  76.         end
  77.     end
  78. end
  79.  
  80.  
  81. -- Checks to see if the key that is being pressed is 'F'
  82. function isKeyPressedF()
  83.     return UserInputService:IsKeyDown(fKey)
  84. end
  85.  
  86.  
  87. -- When the left mousebutton is pressed over the back button
  88. dockyardTerminalBackButton.MouseButton1Down:Connect(backButtonOnPressed)
  89. -- When the left mousebutton is pressed over the exit button
  90. dockyardTerminalExitButton.MouseButton1Down:Connect(exitButtonOnPressed)
  91. -- When the user presses a key
  92. UserInputService.InputBegan:Connect(enableFrame)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement