SHOW:
|
|
- or go back to the newest paste.
1 | --//SERVICES//-- | |
2 | local MarketPlaceService = game:GetService('MarketplaceService') | |
3 | ||
4 | local ServerStorage = game:GetService('ServerStorage') | |
5 | ||
6 | --//GAMEPASS ITEMS--// | |
7 | local SpeedCoilItem = ServerStorage:WaitForChild('SpeedCoil') | |
8 | local GravityCoilItem = ServerStorage:WaitForChild('GravityCoil') | |
9 | local MagicCarpetItem = ServerStorage:WaitForChild('RainbowMagicCarpet') | |
10 | ||
11 | --//GAMEPASS IDS//-- | |
12 | local SpeedCoil = 7685074 | |
13 | local GravityCoil = 7685081 | |
14 | local MagicCarpet = 7482682 | |
15 | ||
16 | --//FUNCTIONS//-- | |
17 | ||
18 | MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player,gamePassId,purchaseSuccess) | |
19 | ||
20 | if purchaseSuccess then -- if a purchase was successfully made | |
21 | ||
22 | if gamePassId == SpeedCoil then | |
23 | ||
24 | local SpeedCoilClone = SpeedCoilItem:Clone() | |
25 | SpeedCoilClone.Parent = player:WaitForChild('Backpack') -- giving a speed coil if they bought it | |
26 | ||
27 | elseif gamePassId == GravityCoil then | |
28 | ||
29 | local GravityCoilClone = GravityCoilItem:Clone() | |
30 | GravityCoilClone.Parent = player:WaitForChild('Backpack') -- giving a gravity coil if they bought it | |
31 | ||
32 | elseif gamePassId == MagicCarpet then | |
33 | ||
34 | local MagicCarpetClone = MagicCarpetItem:Clone() | |
35 | MagicCarpetClone.Parent = player:WaitForChild('Backpack') -- giving a magic carpet if they bought it | |
36 | end | |
37 | end | |
38 | ||
39 | end) | |
40 | ||
41 | game.Players.PlayerAdded:Connect(function(player) | |
42 | player.CharacterAdded:Connect(function() | |
43 | local SpeedCoilCheck = MarketPlaceService:UserOwnsGamePassAsync(player.UserId,SpeedCoil) | |
44 | local GravityCoilCheck = MarketPlaceService:UserOwnsGamePassAsync(player.UserId,GravityCoil) | |
45 | local MagicCarpetChcek = MarketPlaceService:UserOwnsGamePassAsync(player.UserId,MagicCarpet) | |
46 | ||
47 | -- if they own any of these gamepasses then give the corresponding item | |
48 | ||
49 | if SpeedCoilCheck then | |
50 | local SpeedCoilClone = SpeedCoilItem:Clone() | |
51 | SpeedCoilClone.Parent = player.Backpack | |
52 | end | |
53 | ||
54 | if GravityCoilCheck then | |
55 | local GravityCoilClone = GravityCoilItem:Clone() | |
56 | GravityCoilClone.Parent = player.Backpack | |
57 | end | |
58 | ||
59 | if MagicCarpetChcek then | |
60 | local MagicCarpetClone = MagicCarpetItem:Clone() | |
61 | MagicCarpetClone.Parent = player.Backpack | |
62 | end | |
63 | end) | |
64 | end) |