I've wrote a previous script before this one and both haven't worked for me. The script and input runs through and does the print("") function but the GUIs disappear.
I've tried everything I could and nothing seems to work so I'm asking for help here.
Here is the script:
-- Main Variable --
local Menu = game.StarterGui.ScreenGui.MenuGUI
local plr = game.Players.LocalPlayer
-- Sub Menu Variables --
local Profile = Menu.Profile
local Friends = Menu.Friends
local Messages = Menu.Messages
local Location = Menu.Location
local Settings = Menu.Settings
-- Profile Image Variable --
local PFP = Menu.PlayerProfile
-- Input Variables --
local UIS = game:GetService('UserInputService')
-- Change GUI Position --
-- E to activate GUI --
plr:GetMouse().KeyDown:Connect(function(K)
if K == "e" then
Profile.Visible = false
Friends.Visible = false
print("Menu GUI Deactivated")
end
end)
All of the variables are organized and I've made sure that they were correct but I've tried changing inputs and making it a thing that happens when joining but it doesn't work.
I was trying to link a link to the image of the folder but I can't figure out how to so bear with me please

2 comments
Why are you allocating UIS, then using a deprecated input-detection method...?
Also, StarterGui is a replication container. The GUIs are shifted into individual folders in each Client called "PlayerGui". You can reference this through the LocalPlayer Object.