This wont work because your taking the StarterGui, You need to take the Player's PlayerGui.
READ THIS: If you want it to not only hide and also show, I prefer you use the last script. If you want it to only hide, I prefer you use the 3rd script.
Here is the fixed script:
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local FGHUB = PlayerGui.FGHUB
script.Parent.MouseButton1Click:Connect(function()
FGHUB.MainFrame.Visible = false
FGHUB.UpperLine.Visible = false
FGHUB.DownLine.Visible = false
FGHUB.LeftLine.Visible = false
FGHUB.RightLine.Visible = false
FGHUB.Login.Visible = false
FGHUB.Password.Visible = false
FGHUB.Username.Visible = false
FGHUB.FGHub.Visible = false
end)
If you want it to not only hide and also show use this script:
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local FGHUB = PlayerGui.FGHUB
script.Parent.MouseButton1Click:Connect(function()
if FGHUB.MainFrame.Visible == true then
FGHUB.MainFrame.Visible = false
FGHUB.UpperLine.Visible = false
FGHUB.DownLine.Visible = false
FGHUB.LeftLine.Visible = false
FGHUB.RightLine.Visible = false
FGHUB.Login.Visible = false
FGHUB.Password.Visible = false
FGHUB.Username.Visible = false
FGHUB.FGHub.Visible = false
else
FGHUB.MainFrame.Visible = true
FGHUB.UpperLine.Visible = true
FGHUB.DownLine.Visible = true
FGHUB.LeftLine.Visible = true
FGHUB.RightLine.Visible = true
FGHUB.Login.Visible = true
FGHUB.Password.Visible = true
FGHUB.Username.Visible = true
FGHUB.FGHub.Visible = true
end
end)
If you want it more nicer, Organized and shorter use this script:
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local FGHUB = PlayerGui.FGHUB
script.Parent.MouseButton1Click:Connect(function()
FGHUB.Enabled = false
end)
If you want it more nicer, Organized, Shorter and you want it to not only hide it and also show use this script:
local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local FGHUB = PlayerGui.FGHUB
script.Parent.MouseButton1Click:Connect(function()
if FGHUB.Enabled == true then
FGHUB.Enabled = false
else
FGHUB.Enabled = true
end
end)
If this helped you please accept my answer that would be really appreciated.
-MajinBluee
3 comments
You are editing the startgui which isnt in the player,use playergui which is inside each player instance
I recommend using a remote event
username and password frames? are you making a scam game?