I didn't know what to name the title but basically here is my code and I want to reference a text label but it's on StarterGui, MenuGui, Frame, Text Button. Here is my code.
local textButton = script.Parent local textLabel = game.Workspace.StarterGui.MenuGui.Frame.TextButton.textLabel textButton.MouseButton1Click:Connect(function() textLabel.Visible = true end)
A couple of things to list right off the bat:
1. StarterGui is a service and not a member of game.Workspace
2. The version of the ScreenGui that you are referencing in StarterGui will not be changed. No players have direct access to the version in StarterGui. The correct method would be accessing the GUI from the Player's PlayerGui folder (a child of the Player instance in "Players" service)
LocalScript:
local textButton = script.Parent local Player = game:GetService("Players").LocalPlayer local textLabel = Player.PlayerGui.MenuGui.Frame.TextButton.textLabel -- If textLabel is a child of the textButton variable, you could also do -- local textLabel = textButton:WaitForChild("textLabel") textButton.MouseButton1Click:Connect(function() textLabel.Visible = true end)
I would also recommend doing checks to make sure each element you are referencing actually exists to prevent nil errors.