I have a script for a text button that I want to prompt a purchase for the gamepass and if the player owns the gamepass I want to open a frame here is my code:
local players = game:GetService("Players")
local MPS = game:GetService("MarketplaceService")
local passId = 39692796
game.StarterGui.VipScreen.VipOpener.MouseButton1Click:Connect(function()
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if MPS:UserOwnsGamePassAsync(player.UserId,39692796) then
local UI = script.VIP:clone()
UI.Parent = game.PlayerGui
end
end)
end)
end)
The script is in ServerScriptService, Thanks.

4 comments
Hm Wierd it's not adding to the players Gui and how would I make it so a purchase prompt pops up if you don't own the pass thanks.
replace line 10 to add it in to the player ui, as for the purchase prompt do it yourself watch a tutorial
Ok Thanks
Yw