Button not detecting clicks

i would say try putting WaitForChild but you said there’s no errors (no index errors)

-- Put scripts that deal with multiple ScreenGui's in StarterPlayerScripts
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")

local IndexGui = PlayerGui:WaitForChild("IndexGui") -- Keep names consistant
local ScreenGui = PlayerGui:WaitForChild("ScreenGui")
local IndexOpener = ScreenGui:WaitForChild("IndexOpener")

IndexOpener.MouseButton1Click:Connect(function()
  print("Clicked!")
  print(IndexGui.Enabled)
  IndexGui.Enabled = not IndexGui.Enabled
end)