I made an inventory system where you press E to open your inventory. I also made a title screen. Before I made this, the inventory could open before I actually pressed the start button. Now it doesn't open at all. I tried everything but it still doesn't work. This is the script:
local Mouse = game.Players.LocalPlayer:GetMouse()
local BackGround = game.Players.LocalPlayer:WaitForChild('PlayerGui').Inventory.Background.BackGround
local Start = game.Players.LocalPlayer:WaitForChild('PlayerGui').TitleScreen.Start.StartButton
InTitle = true
InInventory = false
Start.MouseButton1Click:Wait(function()
InTitle = false
end)
Mouse.KeyDown:Connect(function(key)
if key:lower() == "e" or key:upper() == "E" then
if InTitle == false then
if InInventory == false then
BackGround:TweenPosition(UDim2.new(0,0,-0.1,0), nil, nil, 2.5)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
wait(2.5)
InInventory = true
end
end
end
end)
Mouse.KeyDown:Connect(function(input)
if input:lower() == "e" or input:upper() == "E" then
if InTitle == false then
if InInventory == true then
BackGround:TweenPosition(UDim2.new(-1,0,-0.1,0), nil, nil, 2.5)
wait(2.5)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
InInventory = false
end
end
end
end)
If anyone knows the problem, please help.

5 comments
Are there any errors? Whats this script: Local or Server? Where did you put the script?
local
When I try to recreate this i get Inventory is not a valid member of PlayerGui is this what you get?
no, I made a folder called inventory. That is what inventory is.
What error are you getting and where is this Inventory folder?