Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Shop not opening when clicking the button?

Asked by
CodeWon 181
3 years ago

So I was adding a shop to my game and I was making the button to open the shop.

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Visible = false
    game.StarterGui.Shop.MainShop.Visible = true
end)

Its a fairly simple script Line 1 and 2 where working fine, but on line 3 the shop wouldn't open.

Could someone please help me, thanks!

1 answer

Log in to vote
0
Answered by 3 years ago

To fix this, I would recommend putting the shop gui in the player who clicked it's gui specifically, like this:

    script.Parent.MouseButton1Click:Connect(function(player)
        script.Parent.Visible = false
       player.PlayerGui.Shop.MainShop.Visible = true
    end)

Happy scripting! :)

Ad

Answer this question