Issue making the gui visble when the player owns the gamepass

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want it to make the GUI visible when you click on the part for when the player owns the game pass

  2. What is the issue? Include screenshots / videos if possible!
    I got it to PromptGamePassPurchase when you you click the part but I’m trying to make it where if the player owns the gamepass when you click on the part it will make the GUI visible but its not doing that

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    nothing I just don’t know whats wrong with it
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

here my client script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playergui = player:FindFirstChild("PlayerGui")
local checkingui = playergui:FindFirstChild("checkin")

local promptGamePassEvent = ReplicatedStorage:WaitForChild("PromptGamePassEvent")


local function checkGamePassOwnership(player, gamePassId)
	return MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassId)
end


promptGamePassEvent.OnClientEvent:Connect(function(gamePassId)
	if checkGamePassOwnership(player, gamePassId) then
		checkingui.Enabled = true
	else
		MarketplaceService:PromptGamePassPurchase(player, gamePassId)
	end
end)

here my server script

local part = script.Parent.ClickDet
local clickDetector = part:FindFirstChild("ClickDetector")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local promptGamePassEvent = ReplicatedStorage:WaitForChild("PromptGamePassEvent")
local gamePassId = 989837059  

clickDetector.MouseClick:Connect(function(player)
	game:GetService("MarketplaceService"):PromptGamePassPurchase(player, gamePassId)
	promptGamePassEvent:FireClient(player, gamePassId)
end)

1 Like