OpenShop
script.Parent.MouseClick:Connect(function(player)
player.PlayerGui.Shop.Background.Visible = true
end)
CloseShopSystem
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
end)
When I click on the invisible part the UI opens, but after I close it doesn’t open anymore.
Thanks.
Have you tried making OpenShop a LocalScript instead of a Server Script?
1 Like
This is due to how the client-server model functions. On your second attempt of opening the store gui, your server-side script believes that the player’s shop background still has its Visible property set to true. Since you set that property to false client-side, that information won’t be passed to the server.
You could fix this by having the MouseClick event be connected client-side. In your CloseShopSystem, just index where the part is and connect to it with the MouseClick event. It should look something like this:
workspace.OpenShopClick.ClickDetector.MouseClick:Connect(function()
player.PlayerGui.Shop.Background.Visible = true
end)
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
end)
1 Like