local MarketplaceService = game:GetService("MarketplaceService")
local tst1 = script.Parent.Parent.Test1
local tst2 = script.Parent.Parent.test2
local tst3 = script.Parent.Parent.test3
local txtbutton = script.Parent.Parent.CloseShop
local MainFrame = script.Parent
local VipGamepass = MainFrame.VipGamepassFrame.Buy
local ColorChangeNameGamepass = MainFrame.ColorChangeGamepassFrame.Buy3
local JetskiGamepass = MainFrame.JetskiGamepassFrame.Buy5
local PetFishGamepass = MainFrame.PetFishTrailGamepassFrame.Buy6
local RedTrailGamepass = MainFrame.RedTrailGamepassFrame.Buy8
local SubmarineGamepass = MainFrame.SubmarineGamepassFrame.Buy9
local SurfboardGamepass = MainFrame.SurfboardsGamepassFrame.Buy10
local OpenShop = MainFrame.Parent.OpenShop
local player = game.Players.LocalPlayer
local VipGamepassId = 4811928
local ColorChangeNameGamepassId = 5283084
local JetskiGamepassId = 4934981
local PetFishGamepassId = 5312626
local RedTrailGamepassId = 5182395
local SubmarineGamepassId = 6212971
local SurfboardGamepassId = 5242168
VipGamepass.MouseButton1Down:Connect(function()
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, VipGamepassId)
end)
if hasPass == true then
print("Player has pass")
else
MarketplaceService:PromptGamePassPurchase(player, VipGamepassId)
end
end)
ColorChangeNameGamepass.MouseButton1Down:Connect(function()
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, ColorChangeNameGamepassId)
end)
if hasPass == true then
print("Player has pass")
else
MarketplaceService:PromptGamePassPurchase(player, ColorChangeNameGamepassId)
end
end)
JetskiGamepass.MouseButton1Down:Connect(function()
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, JetskiGamepassId)
end)
if hasPass == true then
print("Player has pass")
else
MarketplaceService:PromptGamePassPurchase(player, JetskiGamepassId)
end
end)
PetFishGamepass.MouseButton1Down:Connect(function()
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, PetFishGamepassId)
end)
if hasPass == true then
print("Player has pass")
else
MarketplaceService:PromptGamePassPurchase(player, PetFishGamepassId)
end
end)
RedTrailGamepass.MouseButton1Down:Connect(function()
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, RedTrailGamepassId)
end)
if hasPass == true then
print("Player has pass")
else
MarketplaceService:PromptGamePassPurchase(player, RedTrailGamepassId)
end
end)
SubmarineGamepass.MouseButton1Down:Connect(function()
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, SubmarineGamepassId)
end)
if hasPass == true then
print("Player has pass")
else
MarketplaceService:PromptGamePassPurchase(player, SubmarineGamepassId)
end
end)
SurfboardGamepass.MouseButton1Down:Connect(function()
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, SurfboardGamepassId)
end)
if hasPass == true then
print("Player has pass")
else
MarketplaceService:PromptGamePassPurchase(player, SurfboardGamepassId)
end
end)
txtbutton.Visible = false
MainFrame.Visible = false
tst1.Visible = false
tst2.Visible = false
tst3.Visible = false
OpenShop.MouseButton1Down:Connect(function()
MainFrame.Visible = not MainFrame.Visible
txtbutton.Visible = not txtbutton.Visible
tst1.Visible = not tst1.Visible
tst2.Visible = not tst1.Visible
tst3.Visible = not tst1.Visible
end)
The issue in the code above is below.
https://gyazo.com/ed429f7205733031872a35d2e4bc8be0
CloseButton:
local MainFrame = script.Parent.Parent
local CloseShop = MainFrame.CloseShop
CloseShop.MouseButton1Down:Connect(function()
MainFrame.Visible = false
end)
Issue: Visible is not a valid member of ScreenGui
How my screen gui is: https://gyazo.com/dea5120a52d77cf89700d5d8910b34ee
Thank you for your help!