View difference between Paste ID: sE3UTnpK and UVggbQWt
SHOW: | | - or go back to the newest paste.
1
local mS = game:GetService("MarketplaceService")
2
local shopEvent = game.ReplicatedStorage.Remotes.Shop
3
local passID = script.ID.Value
4
local player = game.Players.LocalPlayer
5
local textLabel = script.Parent.TextLabel
6
local hasPass = false
7
8
9
local function Action()
10
    shopEvent:FireServer(passID)
11
    textLabel.TextColor3 = Color3.fromRGB(96,235,36)
12
end
13
14
script.Parent.MouseButton1Click:Connect(function()
15
    mS:PromptGamePassPurchase(player, passID)
16
end)
17
18
mS.PromptGamePassPurchaseFinished:Connect(
19
    function(player,id,purchased)
20
        if purchased and id == passID then
21
            Action()
22
        end
23
    end
24
)
25
26
hasPass = mS:UserOwnsGamePassAsync(player.UserId, passID)
27
if hasPass == true then
28
    Action()
29
end
30