wdym? if you do it in a server script it will return nil. The only time you can get local player from a server script is via remote events but i’m trying to keep it simple
Please define your objects before you use them. This makes your script much easier to read.
local button = script.Parent
local playerGui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
local gui = playerGui:WaitForChild("TicketGUI")
function OnClick()
gui.Enabled = false -- or 'not gui.Enabled' if you the button should toggle
end
button.MouseButton1Click:Connect(OnClick)