You can get GUI objects like this:
lua
CopyEdit
local ScreenGui = script.Parent
local TextButton = ScreenGui.TextButton
local Frame = ScreenGui.Frame
local Player = game.Players.LocalPlayer
Use .Visible to show/hide GUI parts on button click — like your example:
lua
CopyEdit
TextButton.MouseButton1Click:Connect(function()
if Frame.Visible then
Frame.Visible = false
else
Frame.Visible = true
end
end)
lua
CopyEdit
Frame.Visible = not Frame.Visible
You can update button or label text based on actions:
lua
CopyEdit
TextButton.Text = "Click me!"
TextButton.MouseButton1Click:Connect(function()
TextButton.Text = "Clicked!"
end)
Modify colors, fonts, transparency for feedback or styling:
lua
CopyEdit
Frame.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red background
TextButton.TextColor3 = Color3.fromRGB(255, 255, 255) -- White text
TextButton.Font = Enum.Font.SourceSansBold
TextButton.TextSize = 20