When the game starts, all of the things inside the StarterGui is cloned inside the player’s PlayerGui folder, so you may change that directory.
Try this:
local Menu = game.Players.LocalPlayer.PlayerGui["Main Menu"]
local Frame = game.Players.LocalPlayer.PlayerGui["Main Menu"].Frame
local PC = game.Players.LocalPlayer.PlayerGui.PartCount
Change MouseButton1Down to MouseButton1Click, because then it will also work to Mobile players.
Since all the Ui is getting clones to the player, its best to call it within the player. Calling it from StarterGui just does it to everyone in the server basically.
Just a side note, but just identifying the PlayerGui alone without no confirmation could result in an error
Use WaitForChild() to yield the current thread, so that you know that you have the Gui & Frame:
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Menu = PlayerGui:WaitForChild("Main Menu")
local Frame = Menu.Frame
local PC = game.Players.LocalPlayer.PlayerGui:WaitForChild("PartCount")
script.Parent.MouseButton1Down:Connect(function()
Frame.Visible = false
Menu.Enabled = false
game.Lighting.Blur:Destroy()
PC.Enabled = true
end)
There isn’t anything really defined as a variable called “PC”, so I have no clue it may be defined as some, maybe a GuiObject or something (The rest of the code seems fine however)