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

What happened to my code once I added the Inventory part? Answered

Asked by 7 years ago
Edited 7 years ago

I keep trying to make my Inventory button work, but when ever I press the play button on my Title Screen, it appears for a split second until it disappears. What is happening? This is what I used:

----------Title Screen Code----------

wait (0.5)
local TitleScreen = game.Players.LocalPlayer.PlayerGui:WaitForChild("TitleGui")
local TitleFrame = TitleScreen:WaitForChild("TitleFrame")
local TitleButton = TitleFrame:WaitForChild("PlayButton")
local TitleText = TitleFrame:WaitForChild("TitleText")
TitleScreen.Enabled = true

game.Players.playerAdded:connect(function(player)
    TitleScreen.Enabled = true
end)

TitleButton.MouseButton1Down:connect(function(player)
    TitleScreen.Enabled = false
end)

----------Shop Code----------

local ShopScreen = game.Players.LocalPlayer.PlayerGui:WaitForChild("ShopGui")
local ShopFrame = ShopScreen:WaitForChild("ShopFrame")
local ShopButton = ShopScreen:WaitForChild("ShopButton")
local ShopScrollFrame = ShopFrame:WaitForChild("ShopScrollFrame")
local ShopBack = ShopFrame:WaitForChild("BackButton")
ShopScreen.Enabled = false
ShopFrame.Visible = false
ShopButton.Visible = true
ShopScrollFrame.Visible = false
ShopBack.Visible = false

while TitleScreen.Enabled == true do
    wait()
end

if TitleScreen.Enabled == false then
    ShopScreen.Enabled = true
end

ShopButton.MouseButton1Down:connect(function(player)
    ShopButton.Visible = false
    ShopFrame.Visible = true
    ShopScrollFrame.Visible = true
    ShopBack.Visible = true
end)

ShopBack.MouseButton1Down:connect(function(player)
    ShopButton.Visible = true
    ShopFrame.Visible = false
    ShopScrollFrame = false
    ShopBack.Visible = false
end)

-----------Inventory Code----------

local InvScreen = game.Players.LocalPlayer.PlayerGui:WaitForChild("InventoryGui")
local InvFrame = InvScreen:WaitForChild("InvFrame")
local InvButton = InvScreen:WaitForChild("InvButton")
local InvScrollFrame = InvFrame:WaitForChild("InvScrollFrame")
local InvBack = InvFrame:WaitForChild("BackButton")
InvScreen.Enabled = false
InvFrame.Visible = false
InvButton.Visible = true
InvScrollFrame.Visible = false
InvBack.Visible = false

while TitleScreen.Enabled == true do 
    wait()
end

if TitleScreen.Enalbed == false then
    InvScreen.Enabled = true
end

while ShopFrame.Visible == true do
    wait()
end

if ShopFrame.Visible == false then
    InvScreen.Enabled = true
end

while InvFrame.Visible == true do
    wait()
end

if InvFrame.Visible == false then
    ShopScreen.Enabled = true
end

InvButton.MouseButton1Down:connect(function(player)
    InvButton.Visible = false
    InvFrame.Visible = true
    InvScrollFrame.Visible = true
    InvBack.Visible = true
end)

InvBack.MouseButton1Down:connect(function(player)
    InvButton.Visible = true
    InvFrame.Visible = false
    InvScrollFrame.Visible = false
    InvBack.Visible = false
end)

The problem should be somewhere in the Inventory Code area since my code worked before I made that part. Thanks for helping!

1
Did you check output for errors? Line 70 says "TitleScreen.Enalbed".. Pyrondon 2089 — 7y
0
Thanks! I'll see if they fixes everything! marioblast1244 113 — 7y
0
Great! It does! marioblast1244 113 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Has been answered by Pyrondon.

Ad

Answer this question