For somereason after it is purchased it is not fireing the server…
script.Parent.MouseButton1Click:Connect(function()
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 811273501 -- Change to your Gamepass ID
local HasPass
local Gui = script.Parent.Parent.Parent.Parent.Parent.txt -- Change OpenGui to whatever your gui that is going to open is called
local Player = game.Players.LocalPlayer
local success, message = pcall(function()
HasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID)
game.ReplicatedStorage.twxCash:FireServer()
end)
if HasPass then
game.ReplicatedStorage.twxCash:FireServer()
Gui.Visible = true
wait(3) -- You can adjust how long the other frame is open if the player already has the gamepass
Gui.Visible = false
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassID)
end
end)
script.Parent.MouseButton1Click:Connect(function()
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 811273501 -- Change to your Gamepass ID
local HasPass
local Gui = script.Parent.Parent.Parent.Parent.Parent.txt -- Change OpenGui to whatever your gui that is going to open is called
local Player = game.Players.LocalPlayer
HasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID)
if HasPass then
game.ReplicatedStorage.twxCash:FireServer()
Gui.Visible = true
wait(3) -- You can adjust how long the other frame is open if the player already has the gamepass
Gui.Visible = false
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassID)
end
end)
script.Parent.MouseButton1Click:Connect(function()
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 811273501 -- Change to your Gamepass ID
local HasPass
local Gui = script.Parent.Parent.Parent.Parent.Parent.txt -- Change OpenGui to whatever your gui that is going to open is called
local Player = game.Players.LocalPlayer
local success, message = pcall(function()
HasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID)
game.ReplicatedStorage.twxCash:FireServer()
end)
if HasPass then
game.ReplicatedStorage.twxCash:FireServer()
Gui.Visible = true
wait(3) -- You can adjust how long the other frame is open if the player already has the gamepass
Gui.Visible = false
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassID)
end
end)
Make a server sided script that checks for when a gamepass is purchased, so for example:
local MarketplaceService = game:GetService("MarketplaceService")
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamePassId, wasPurchased)
if wasPurchased and gamePassId == 811273501 then
-- do the function here
end
end)
script.Parent.MouseButton1Click:Connect(function()
local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 811273501 -- Change to your Gamepass ID
local HasPass
local Gui = script.Parent.Parent.Parent.Parent.Parent.txt -- Change OpenGui to whatever your gui that is going to open is called
local Player = game.Players.LocalPlayer
local success, message = pcall(function()
HasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassID)
game.ReplicatedStorage.twxCash:FireServer()
end)
if HasPass then
game.ReplicatedStorage.twxCash:FireServer()
Gui.Visible = true
wait(3) -- You can adjust how long the other frame is open if the player already has the gamepass
Gui.Visible = false
else
MarketplaceService:PromptGamePassPurchase(Player, GamepassID)
end
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamepassID, purchaseSuccess)
--add script here
end)
I don’t know but, you can try that if a person doesn’t have a gamepass, then the prompt shows and if they purchased it, then the player can click the same thing, and they will get the FireServer() thing