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