I have no clue what I am doing wrong please help me, thanks
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent.Parent.ShopFrame.ShopFrame.Visible = true if script.Parent.Parent.Parent.Parent.ShopFrame.ShopFrame.Visible == true then script.Parent.Parent.Parent.Parent.ShopFrame.ShopFrame.Visible = false end end
Do you want help with the script? I got the script right here for you:
local ShopFrame = script.Parent.Parent.Parent.Parent.ShopFrame.ShopFrame --For it to be faster script.Parent.MouseButton1Click:connect(function() ShopFrame.Visible = not ShopFrame.Visible end)
You were constantly updating the Frame to be visible everytime someone clicked the button by including it in the function. This script fixes that.
local ShopFrame = script.Parent.Parent.Parent.Parent.ShopFrame.ShopFrame --Indexes placement of Frame ShopFrame.Visible = true --Here we can change the Frame to be visible during the start script.Parent.MouseButton1Click:Connect(function() --When a player hits a button if ShopFrame.Visible == true then --If visible then ShopFrame.Visible = false --Change it back to false elseif ShopFrame.Visible == false then --If invisible then ShopFrame.Visible = true --Change it back to true end end)
If this helped, be sure to accept my answer!