Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Path to the PlayerGui, waits for PlayerGui to be created
- local PlayerGui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
- -- Path to the service that detects which keys are pressed
- local UserInputService = game:GetService("UserInputService")
- -- Path to target working directory of the entire project, waits for the entire GUI to load?
- local TWD = PlayerGui:WaitForChild("DockyardTerminalDemo")
- -- Path to target working directory of a specific function
- local dockyardTerminalTWD = TWD.DockyardMain.Container.TopBar
- -- The Parent frame containing all of the objects we will be modifying
- local dockyardTerminalMainFrame = TWD.DockyardMain
- -- The Title displayed on the target frame
- local dockyardTerminalTitle = dockyardTerminalTWD.TitleLabel
- -- The subtitle text contained on the frame on the screen
- local dockyardTerminalSubtitle = dockyardTerminalTWD.PageSubtitle
- -- The button we will use to change the text displayed on the topbar
- local dockyardTerminalBackButton = dockyardTerminalTWD.BackToHome
- -- The button we will used to exit the GUI
- local dockyardTerminalExitButton = dockyardTerminalTWD.ExitTerminal
- -- A list that stores the keys used in stringDictionary
- local stringTableKeysArray = {"Oseday", "Nevs", "Cameron", "Sanddog"}
- -- Initialize a dictionary to hold string values tied to their respective keys
- local stringDictionary = {}
- -- Not the conventional way to generate several dict items but I couldn't get it to accept string keys
- stringDictionary["Oseday"] = "yo guys halp find who she is"
- stringDictionary["Nevs"] = "Oseday I told you I could figure this shit out dawggg"
- stringDictionary["Cameron"] = "il ve og ib 5"
- stringDictionary["Sanddog"] = "HES GOING FOR THE LONG THROW PASS!!!!!!!!!!!!!!!!!!!"
- local stringIteration = 1
- local frameEnabled = false
- -- The 'F' key
- local fKey = Enum.KeyCode.F
- -- First lets try to change the title text on the topbar just for the heck of it
- PlayerGui.DockyardTerminalDemo.DockyardMain.Container.TopBar.TitleLabel.Text = stringTableKeysArray[stringIteration]
- -- Changes the Title and Subtitle of the dockyard terminal topbar when the back button is pressed
- function backButtonOnPressed()
- if stringIteration == 4 then
- -- Reset the key to the first item in the list
- stringIteration = 1
- -- Update the text title and subtitle
- dockyardTerminalTitle.Text = stringTableKeysArray[stringIteration]
- dockyardTerminalSubtitle.Text = stringDictionary[stringTableKeysArray[stringIteration]]
- else
- -- Advance to the next key
- stringIteration = stringIteration + 1
- -- Update the text title and subtitle
- dockyardTerminalTitle.Text = stringTableKeysArray[stringIteration]
- dockyardTerminalSubtitle.Text = stringDictionary[stringTableKeysArray[stringIteration]]
- end
- end
- -- Sets the dareglass window to inactive
- function exitButtonOnPressed()
- if TWD.Enabled == true then
- frameEnabled = false
- TWD.Enabled = false
- end
- end
- -- Allows the player to activate the frame with the F key
- function enableFrame(input, gameProcessedEvent)
- if isKeyPressedF() == true then
- if frameEnabled == false then
- frameEnabled = true
- TWD.Enabled = true
- end
- end
- end
- -- Checks to see if the key that is being pressed is 'F'
- function isKeyPressedF()
- return UserInputService:IsKeyDown(fKey)
- end
- -- When the left mousebutton is pressed over the back button
- dockyardTerminalBackButton.MouseButton1Down:Connect(backButtonOnPressed)
- -- When the left mousebutton is pressed over the exit button
- dockyardTerminalExitButton.MouseButton1Down:Connect(exitButtonOnPressed)
- -- When the user presses a key
- UserInputService.InputBegan:Connect(enableFrame)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement