local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
-- Replace this with your actual Game Pass ID
local gamePassID = RemovedIdstillwasntworkingwithone
-- Reference to the button
local button = script.Parent
-- Function that gets called if the player owns the game pass
local function onGamePassOwned(player)
print(player.Name .. " owns the game pass!")
-- Custom functionality: Fire the specific function
require(RemovedIdstillwasntworkingwithone):Fire(player.Name)
end
-- Function to handle button click
local function OnClick()
local player = Players.LocalPlayer
if player then
-- Check if the player owns the game pass
local success, hasPass = pcall(function()
return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
end)
if success then
if hasPass then
-- Fire your function if the player owns the game pass
onGamePassOwned(player)
else
-- Prompt the player to purchase the game pass if they don't own it
MarketplaceService:PromptGamePassPurchase(player, gamePassID)
end
else
warn("Failed to check if player owns the game pass")
end
end
end
-- Connect the function to the button's click event
button.MouseButton1Click:Connect(OnClick)"
#Need help with script
6 messages · Page 1 of 1 (latest)