Hierarchy:
> game
> StarterGui
> SurfaceGui
> TextButton
> LocalScript
Script:
local label = game.StarterGui.ScreenGui.TextLabel
local button = script.Parent
button.MouseButton1Click:Connect(function()
if label.Visible == true then
label.Visible = false
elseif label.Visible == false then
label.Visible = true
end
end)

7 comments
where is the local script?
SurfaceGui's aren't meant to be used in StarterGui, I think you're talking about ScreenGui?
yeah its screen sorry.
and put your localscript inside of the button and write script.Parent.MouseButton1Click:Connect(function() --// Rest of code
well it is in the button and ill fix that
its not working
You can’t reference any and all GUIs through StarterGui if you desire to provide functions that modify the players UI live. If this is what you want, you must reference PlayerGui instead.