I am making a shop GUI in my game and I've made the button to open it and a button on the ScrollingFrame itself, and when I click the close button, the Open shop button won't work.
Code for the Open Button:
local object = script.Parent.Parent.Parent.ScrollingFrame object.AnchorPoint = Vector2.new(0.5, 0.5) object.Position = UDim2.new(-1, 0, 0.5, 0) script.Parent.MouseButton1Click:Connect(function() object:TweenPosition(UDim2.new(0.5, 0, 0.5, 0)) end)
Code for the Close Button:
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = false end)
I am quite new to scripting so please don't talk about my poor coding skills :)
Its only running a single time because when opening it it just moves it to another position and when closing the is made invisble. The button is actually working but the gui stays invisible when you want it to be visible.
Use this script for the open buttom instead of your current.
Please place your UI in the place you want it to be on the players screen.
Next go in properties and uncheck visible.
Open button script:
script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = false script.Parent.Parent.parent.OPENFRAMENAME.Visible = true end)
Code for the Close Button:
script.Parent.Parent.Visible = false script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Visible = not script.Parent.Parent.Visible end)