Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --//SERVICES//--
- local MarketPlaceService = game:GetService('MarketplaceService')
- local ServerStorage = game:GetService('ServerStorage')
- --//GAMEPASS ITEMS--//
- local SpeedCoilItem = ServerStorage:WaitForChild('SpeedCoil')
- local GravityCoilItem = ServerStorage:WaitForChild('GravityCoil')
- local MagicCarpetItem = ServerStorage:WaitForChild('RainbowMagicCarpet')
- --//GAMEPASS IDS//--
- local SpeedCoil = 7685074
- local GravityCoil = 7685081
- local MagicCarpet = 7482682
- --//FUNCTIONS//--
- MarketPlaceService.PromptGamePassPurchaseFinished:Connect(function(player,gamePassId,purchaseSuccess)
- if purchaseSuccess then -- if a purchase was successfully made
- if gamePassId == SpeedCoil then
- local SpeedCoilClone = SpeedCoilItem:Clone()
- SpeedCoilClone.Parent = player:WaitForChild('Backpack') -- giving a speed coil if they bought it
- elseif gamePassId == GravityCoil then
- local GravityCoilClone = GravityCoilItem:Clone()
- GravityCoilClone.Parent = player:WaitForChild('Backpack') -- giving a gravity coil if they bought it
- elseif gamePassId == MagicCarpet then
- local MagicCarpetClone = MagicCarpetItem:Clone()
- MagicCarpetClone.Parent = player:WaitForChild('Backpack') -- giving a magic carpet if they bought it
- end
- end
- end)
- game.Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function()
- local SpeedCoilCheck = MarketPlaceService:UserOwnsGamePassAsync(player.UserId,SpeedCoil)
- local GravityCoilCheck = MarketPlaceService:UserOwnsGamePassAsync(player.UserId,GravityCoil)
- local MagicCarpetChcek = MarketPlaceService:UserOwnsGamePassAsync(player.UserId,MagicCarpet)
- -- if they own any of these gamepasses then give the corresponding item
- if SpeedCoilCheck then
- local SpeedCoilClone = SpeedCoilItem:Clone()
- SpeedCoilClone.Parent = player.Backpack
- end
- if GravityCoilCheck then
- local GravityCoilClone = GravityCoilItem:Clone()
- GravityCoilClone.Parent = player.Backpack
- end
- if MagicCarpetChcek then
- local MagicCarpetClone = MagicCarpetItem:Clone()
- MagicCarpetClone.Parent = player.Backpack
- end
- end)
- end)
Add Comment
Please, Sign In to add comment