Advertisement
drakon-firestone

LocalScript

Nov 24th, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement