Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make my inventory GUI to be already closed while playing the game ?

So , my problem is like , i ve got an inventory GUI , but when i hit play , it s already open and i have to close it myself everytime , what should i do to make it already closed?

here is the whole script

local imageLabel = script.Parent

local player = game.Players.LocalPlayer

local playerInventory = player:WaitForChild('Inventory')

local openButton = imageLabel.Open
local isOpen = true

local crystal1 = playerInventory:FindFirstChild('Blue')
local crystal1Label = imageLabel.Amount1

local crystal2 = playerInventory:FindFirstChild('Red')
local crystal2Label = imageLabel.Amount2

local crystal3 = playerInventory:FindFirstChild('Green')
local crystal3Label = imageLabel.Amount3

local crystal4 = playerInventory:FindFirstChild('Yellow')
local crystal4Label = imageLabel.Amount4

local crystal5 = playerInventory:FindFirstChild('Pink')
local crystal5Label = imageLabel.Amount5

local crystal6 = playerInventory:FindFirstChild('Black')
local crystal6Label = imageLabel.Amount6

crystal1.Changed:Connect(function()
	crystal1Label.Text = crystal1.Value
end)

crystal2.Changed:Connect(function()
	crystal2Label.Text = crystal2.Value
end)

crystal3.Changed:Connect(function()
	crystal3Label.Text = crystal3.Value
end)

crystal4.Changed:Connect(function()
	crystal4Label.Text = crystal4.Value
end)

crystal5.Changed:Connect(function()
	crystal5Label.Text = crystal5.Value
end)

crystal6.Changed:Connect(function()
	crystal6Label.Text = crystal6.Value
end)


openButton.MouseButton1Click:Connect(function()
	if isOpen then
		imageLabel:TweenPosition(UDim2.new(-0.2, 0, 0.049, 0), "Out", "Quad", 1, true)
	else	
		imageLabel:TweenPosition(UDim2.new(0, 0, 0.049, 0), "Out", "Quad", 1, true)	
	end
	isOpen = not isOpen
end)

1 answer

in the script, make it so the inventory is not visible by doing this is an example don't use this

script.Parent.Visible = false

This discussion is preserved as it was. New answers, comments, and votes are closed.