Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why can't I open the inventory after I press start?

Asked by 4 years ago

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.

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

1 answer

Log in to vote
0
Answered by 4 years ago

Never mind, I fixed it.

Ad

Answer this question