GUIs won't close when a click part is clicked fix?
I'm creating a click part that opens a shop GUI when the player clicks it. However, there are multiple GUIs in my game and I'd like them to close if they are open when the player clicks the part. When I'm in the studio and I click the part, nothing happens. Here's my LocalScript:
02 | local plr = game.Players.LocalPlayer |
04 | script.Parent.Click.MouseClick:Connect( function () |
05 | if debounce = = true then |
06 | plr.PlayerGui.UI.CodesGui:TweenSize(UDim 2. new( 0 , 0 , 0 , 0 ), "Out" , "Quart" , 0.35 ) |
07 | plr.PlayerGui.UI.CodesGui.Visible = false |
08 | plr.PlayerGui.UI.ShopGui:TweenSize(UDim 2. new( 0 , 0 , 0 , 0 ), "Out" , "Quart" , 0.35 ) |
09 | plr.PlayerGui.UI.ShopGui.Visible = false |
10 | plr.PlayerGui.UI.MenuGui:TweenSize(UDim 2. new( 0 , 0 , 0 , 0 ), "Out" , "Quart" , 0.35 ) |
11 | plr.PlayerGui.UI.MenuGui.Visible = false |
13 | plr.PlayerGui.MerchantGui.Frame.Visible = true |
14 | plr.PlayerGui.MerchantGui.Frame:TweenSize(UDim 2. new( 0.295 , 0 , 0.496 , 0 ), "Out" , "Bounce" , 0.5 ) |
When I use a regular script, it works fine but the open GUIs don't close. I'm thinking that the reason is that the GUIs use LocalScripts so the regular script doesn't detect that they're open, but I could be wrong.