local GamepassOne = script.Parent:WaitForChild("GamepassOne")
local GamepassTwo = script.Parent:WaitForChild("GamepassTwo")
local GamepassThree = script.Parent:WaitForChild("GamepassThree")
local GamepassFour = script.Parent:WaitForChild("GamepassFour")
local MarketplaceService = game:GetService("MarketplaceService")
local Player = game.Players.LocalPlayer
local Players = game:GetService("Players")
local GamepassOneId = 133718605
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if MarketplaceService:UserOwnsGamePassAsync(plr.UserId,GamepassOneId) then
print("Hello")
end
end)
end)
GamepassOne.Buy.MouseButton1Click:Connect(function()
local hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassOneId)
if hasPass then
print("User ownes this gamepass already.")
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassOneId)
end
end)
This script isn’t checking if the player owns the gamepass / does not change the button to visible and the other to invisible.
local GamepassOne = script.Parent:WaitForChild("GamepassOne")
local GamepassTwo = script.Parent:WaitForChild("GamepassTwo")
local GamepassThree = script.Parent:WaitForChild("GamepassThree")
local GamepassFour = script.Parent:WaitForChild("GamepassFour")
local MarketplaceService = game:GetService("MarketplaceService")
local Player = game.Players.LocalPlayer
local Players = game:GetService("Players")
local GamepassOneId = 133718605
Players.PlayerAdded:Connect(function(plr)
repeat task.wait()until game.workspace:FindFirstChild(plr.Name)
if MarketplaceService:UserOwnsGamePassAsync(plr.UserId,GamepassOneId) then
print("Hello")
end
end)
GamepassOne.Buy.MouseButton1Click:Connect(function()
local hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassOneId)
if hasPass then
print("User ownes this gamepass already.")
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassOneId)
end
end)
Yes, but there is the buy button which you see now, then their is a owned button which is invisible since its an image. The owned button doesnt show up even though I own the gamepass