local One = script.Parent.One
local Two = script.Parent.Two
local Three = script.Parent.Three
local Four = script.Parent.Four
local Five = script.Parent.Five
local Six = script.Parent.Six
local Seven = script.Parent.Seven
local Eight = script.Parent.Eight
local Nine = script.Parent.Nine
local Add = script.Parent.Add
-- UI
local ExtInv = game.StarterGui.ExtraInventory
Add.MouseButton1Click:Connect(function()
ExtInv.Enabled = true
end)
Problem 2:
local ExtInv = script.Parent
local Close = script.Parent.Close
Close.MouseButton1Click:Connect(function()
ExtInv.Enabled = false
end)
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Visible -- Frame is the UI you want to show
end)
this code will make the frame visible when you click on the shop and if you click on it again it will become invisible
to infinity
You are accessing the StarterGui version of your GUI. Once a player joins, the game loads the GUI(s) to the player’s PlayerGui, in which you should be manipulating the UI components.
Problem 1: Make sure you are using this in a LocalScript:
local One = script.Parent.One
local Two = script.Parent.Two
local Three = script.Parent.Three
local Four = script.Parent.Four
local Five = script.Parent.Five
local Six = script.Parent.Six
local Seven = script.Parent.Seven
local Eight = script.Parent.Eight
local Nine = script.Parent.Nine
local Add = script.Parent.Add
-- UI
local ExtInv = game:GetService("Players").LocalPlayer.PlayerGui.ExtraInventory
Add.MouseButton1Click:Connect(function()
ExtInv.Enabled = true
end)
Problem 2: I’m pretty sure this isn’t a problem.
Problem 3: I’m quite confused as to why you would need two Scripts that does one thing (one closes UI, other opens UI) when they can be done in a single Script?
local One = script.Parent.One
local Two = script.Parent.Two
local Three = script.Parent.Three
local Four = script.Parent.Four
local Five = script.Parent.Five
local Six = script.Parent.Six
local Seven = script.Parent.Seven
local Eight = script.Parent.Eight
local Nine = script.Parent.Nine
local Add = game:GetService("Players").LocalPlayer.PlayerGui.Inventory.Add
-- UI
local ExtInv = game:GetService("Players").LocalPlayer.PlayerGui.ExtraInventory
local Close = game:GetService("Players").LocalPlayer.PlayerGui.ExtraInventory.Frame.Close
Add.MouseButton1Click:Connect(function()
ExtInv.Enabled = not ExtInv.Enabled
end)
Close.MouseButton1Click:Connect(function()
ExtInv.Enabled = false
end)
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Frame.Visible = not script.Parent.Parent.Frame.Visible -- Frame is the UI you want to show
end)
Do that in your script. Just change it to a simple script.
local One = script.Parent:WaitForChild("One")
local Two = script.Parent:WaitForChild("Two")
local Three = script.Parent:WaitForChild("Three")
local Four = script.Parent:WaitForChild("Four")
local Five = script.Parent:WaitForChild("Five")
local Six = script.Parent:WaitForChild("Six")
local Seven = script.Parent:WaitForChild("Seven")
local Eight = script.Parent:WaitForChild("Eight")
local Nine = script.Parent:WaitForChild("Nine")
local Add = script.Parent:WaitForChild("Add")
-- UI
local Players = game:GetService("Players")
local ExtInv = Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ExtraInventory")
Add.MouseButton1Click:Connect(function()
ExtInv.Enabled = true
end)
Problem 2 Solution: (Local Script)
local ExtInv = script.Parent
local Close = script.Parent:WaitForChild("Close")
Close.MouseButton1Click:Connect(function()
ExtInv.Enabled = false
end)
With a normal Script object, you are putting more load on the server (as normal Scripts are intended to be used on the server), load that can be done by the client instead. LocalScripts are the way to go, as the server will not need to deal with each players’ GUIs.