PromptGamePassFinished doesn’t seem to be working correctly for me, or maybe (most likely) I’m doing something wrong. If the player decides not to buy the gamepass and instead hits the cancel button, the character still gets unlocked.
Code:
wait(1)
local GamepassCheck = script.Parent
local GamePassID = 1234
local Player = game.Players.LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")
local Splinter = script.Parent.Parent.Selection
local SplinterTag = game.Players.LocalPlayer.Backpack:WaitForChild("SplinterTag")
GamepassCheck.MouseButton1Click:Connect(function()
MarketplaceService:PromptGamePassPurchase(Player, GamePassID)
end)
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, GamePassID, wasPurchased)
if wasPurchased then
SplinterTag.Value = true
Splinter.Visible = true
Splinter.Selectable = true
GamepassCheck.Visible = false
else
SplinterTag.Value = false
Splinter.Visible = false
Splinter.Selectable = false
GamepassCheck.Visible = true
end
end)
*GamePassID is just a random placeholder ID, but it should still work.
