But when I was finished the scripts didn’t open or close the shop at all please help
I Was doing a video tutorial on YouTube but I cant get In contact with the person who originally made it and I cant find anything on the dev forum about this.
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.ShopFrame.Visible = true -- You tried to get ScreenGui and find ShopFrame for it, but you missed an extra "Parent".
end)
Shop Invisible Script
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false -- You forgot to put Visible
end)
If that doesn’t work, it looks like you’re using the same open button to close. Then you have to use MouseButton1Up, or MouseButton1Down. Like:
There’s really no need for 2 connections, instead you can use if statements to check if the Shop is already visible and if so, it makes it invisible, and that for when It’s invisible too.
The script would look like this:
local ShopFrame = script.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
if ShopFrame.Visible == true then
ShopFrame.Visible = false -- If shop is already visible then it makes it invisible.
else
ShopFrame.Visible = true -- If shop is invisible then it turns visible.
end)
Then it wouldn’t be in a single script, at your localscript called “Shop Invisible” there should be this script:
local ShopFrame = script.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
ShopFrame.Visible = false
end)
In your “Shop Visible” localscript there should be this:
local ShopFrame = script.Parent.Parent.Parent.Parent.ShopGui.ShopFrame -- There's easier way to locate this
script.Parent.MouseButton1Click:Connect(function()
ShopFrame.Visible = true
end)
From what I saw in your first image you should be executing the localscript from ShopButton and It’s name is “Shop Visible” so this error doesn’t seem to be coming from that localscript, but from one located in PlayButton.
Were those the only errors in the Output? Are you sure nothing printed correctly?
Check if there are any errors related to “ShopButton.Shop Visible”
Those errors seem unrelated to “ShopButton.Shop Visible” though, can you see if there’s any errors or anything coming from that localscript? (The Shop Visible one)
If there’s absolutely nothing coming from the ShopVisible localscript then that probably means the MouseClick connection is not even firing, so make sure to check if It’s actually getting triggered.