What did I do wrong in this visible script?

I’m trying to make my buttons disappear when I click a button but when I make the script it doesn’t seem to work what did I do wrong?

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.SettingsFrame.Visible = true
	game.StarterGui.MainMenu.Frame.Chapters.Visible = false
	game.StarterGui.MainMenu.Frame.Donate.Visible = false
	game.StarterGui.MainMenu.Frame.Credits.Visible = false
end)

StarterGui does not belong to the player. You need to use PlayerGui

You should use PlayerGui.

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.SettingsFrame.Visible = true
	PlayerGui.MainMenu.Frame.Chapters.Visible = false
	PlayerGui.MainMenu.Frame.Donate.Visible = false
	PlayerGui.MainMenu.Frame.Credits.Visible = false
end)
1 Like