i tried to make a script which would make a frame visible every time you click on a button, but the script works fine and the frame visible is set to true, but the frame won’t show up
local ShopOpen = script.Parent
local Shop = game.StarterGui.ScreenGui.Shop
local ShopOpenBool = false
ShopOpen.MouseButton1Click:Connect(function()
if ShopOpenBool == false then
ShopOpenBool = true
Shop.Visible = true
elseif ShopOpenBool == true then
ShopOpenBool = false
Shop.Visible = false
end
end)
local ShopOpen = script.Parent
local Shop = script.Parent.Parent.Shop
ShopOpen.MouseButton1Click:Connect(function()
if Shop.Visible == false then
Shop.Visible = true
else
Shop.Visible = false
end
end)
When the player is in the game,
‘StarterGui’ for him is ‘PlayerGui’.
Hence, what you could do, is
What I wrote above.
2)Replace it with -
local ShopOpen = script.Parent
local Player = game.Players.LocalPlayer
local Shop = Player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):FindFirstChild("Frame")
local ShopOpenBool = false
ShopOpen.MouseButton1Click:Connect(function()
if ShopOpenBool == false then
ShopOpenBool = true
Shop.Visible = true
elseif ShopOpenBool == true then
ShopOpenBool = false
Shop.Visible = false
end
end)