How would I run a script from ServerScriptService when a player presses a button in StarterGui?

You can write your topic however you want, but you need to answer these questions:

  1. 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.

  2. 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.

  3. What solutions have you tried so far?

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
image

Thank you for your help!

You don’t.

The server should not handle user input or user interface. The simple answer is to use a LocalScript instead.

Would I have to replicate a script in each button for it to work?

No? You can use one local script to power all of the buttons

Okay, so I should convert my server script to a local script?

Okay, I just converted it over to local and it works perfectly. Thank you for your help!