You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
I want to be able to have a single script that is able to change the text that is displayed on a GUI based on which button a player presses. -
What is the issue?
I am new to scripting and I am stumped as to how I can do this. I have checked all Roblox wiki articles about GUI buttons and none seem to use a single script. I need the script to be able to differentiate between which button a player pressed and when. -
What solutions have you tried so far?
- I have tried reading input from the console: Is there a way of getting input from the console in Roblox?
- I read this on the dev wiki: Creating a Scrolling Frame GUI
- And I have read this as well: GuiButton.MouseButton1Click
Current Script
-- -- QUICK VARIABLES --
local GUI = script.Parent.Parent
local Frame = script.Parent
local Scroll = script.parent.Information
local toggled = false
-- BUTTONS
local MercuryButton = game.StarterGui.Zoomer.Planets.Mercury
local VenusButton = game.StarterGui.Zoomer.Planets.Venus
local EarthButton = game.StarterGui.Zoomer.Planets.Earth
local MarsButton = game.StarterGui.Zoomer.Planets.Mars
local JupiterButton = game.StarterGui.Zoomer.Planets.Jupiter
local SaturnButton = game.StarterGui.Zoomer.Planets.Saturn
local UranusButton = game.StarterGui.Zoomer.Planets.Uranus
local NeptuneButton = game.StarterGui.Zoomer.Planets.Neptune
local PlutoButton = game.StarterGui.Zoomer.Planets.Pluto
-- PLANETS --
local Mercury = workspace.Inner.Mercury
local Venus = workspace.Inner.Venus
local Earth = workspace.Inner.Earth
local Mars = workspace.Inner.Mars
local Jupiter = workspace.Outer.Jupiter
local Saturn = workspace.Outer.Saturn
local Uranus = workspace.Outer.Uranus
local Neptune = workspace.Outer.Neptune
local Pluto = workspace.Outer.Pluto
Explorer Hierarchy
Thank you for your help!