Advertisement
Lucas297

Untitled

Feb 6th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.94 KB | None | 0 0
  1. local CS = game:GetService("CollectionService")
  2. local RS = game:GetService("ReplicatedStorage")
  3. local MS = game:GetService("MarketplaceService")
  4. local PL = game:GetService("Players")
  5. local RSS = game:GetService("RunService")
  6.  
  7. local LocalPlayer = PL.LocalPlayer
  8.  
  9. local leaderstats = LocalPlayer:WaitForChild("leaderstats")
  10. local Rebirths = leaderstats:WaitForChild("Rebirths")
  11.  
  12. local PlayerGui = LocalPlayer.PlayerGui
  13. local MainGui = PlayerGui:WaitForChild("MainGui")
  14. local MainFrames = MainGui:WaitForChild("MainFrames")
  15. local CenterFrame_ = MainFrames:WaitForChild("CenterFrame"):WaitForChild("Frames")
  16. local ShopFrame = CenterFrame_:WaitForChild("ShopFrame")
  17. local SubFrame = ShopFrame:WaitForChild("SubFrame")
  18. local ShopProductFrames = SubFrame:WaitForChild("ShopProductFrames")
  19.  
  20.  
  21. local RSModules = RS:WaitForChild("Modules")
  22. local Config = require(RSModules:WaitForChild("Configuration"))
  23. local Notify = require(RSModules:WaitForChild("NotificationHandler"))
  24. local Short = require(RSModules:WaitForChild("Short"))
  25.  
  26. local ShopHandler = {}
  27.  
  28. function ShopHandler:Init()
  29. ShopHandler:Listener()
  30. end
  31.  
  32. function ShopHandler:Listener()
  33.  
  34. RSS.Heartbeat:Connect(function()
  35. for a,b in pairs(CS:GetTagged("ClickShopProducts")) do
  36. if not b:IsA("TextButton") then continue end
  37. if not tonumber(b.Name) then continue end
  38.  
  39. local PriceFrame = b:WaitForChild("PriceFrame")
  40. local ProdClicks = PriceFrame:WaitForChild("ProdClicks")
  41. local DevProdInfo = Config.DevProducts[tonumber(b.Name)]
  42. ProdClicks.Text = "+" .. Short.en((DevProdInfo.Value * Rebirths.Value) ).. " Clicks"
  43.  
  44. end
  45. for a,b in pairs(CS:GetTagged("GemShopProducts")) do
  46. if not b:IsA("TextButton") then continue end
  47. if not tonumber(b.Name) then continue end
  48.  
  49. local PriceFrame = b:WaitForChild("PriceFrame")
  50. local ProdClicks = PriceFrame:WaitForChild("ProdClicks")
  51. local DevProdInfo = Config.DevProducts[tonumber(b.Name)]
  52.  
  53. ProdClicks.Text = "+" .. Short.en(DevProdInfo.Value).. " Gems"
  54.  
  55. end
  56. end)
  57.  
  58. for a,b in pairs(CS:GetTagged("ShopFrameButton")) do
  59. if not b:IsA("TextButton") then continue end
  60. b.MouseButton1Up:Connect(function()
  61. local TargetFrame = ShopProductFrames:FindFirstChild(b.Name .. "Frame")
  62.  
  63. for c,d in pairs(ShopProductFrames:GetChildren()) do
  64. if not d:IsA("Frame") then continue end
  65. if d.Name == b.Name .. "Frame" then
  66. d.Visible = true
  67. else
  68. d.Visible = false
  69. end
  70. end
  71.  
  72. end)
  73. end
  74.  
  75. for a,b in pairs(CS:GetTagged("ProductButton")) do
  76. if not b:IsA("TextButton") then continue end
  77. if not tonumber(b.Name) then b.Visible = false continue end
  78.  
  79. b.MouseButton1Up:Connect(function()
  80. MS:PromptProductPurchase(LocalPlayer,tonumber(b.Name))
  81. end)
  82. end
  83.  
  84. ShopHandler:LoadShopProducts()
  85. end
  86.  
  87. function ShopHandler:LoadShopProducts()
  88. for a,b in pairs(CS:GetTagged(Config.Tags.GamepassButton)) do
  89.  
  90. if not b:IsA("TextButton") then continue end
  91. if not tonumber(b.Name) then continue end
  92. local function isOwn(gamepassID)
  93. local suc,isOwned = pcall(function()
  94. MS:UserOwnsGamePassAsync(LocalPlayer.UserId,gamepassID)
  95. end)
  96. if not suc then return false end
  97. if isOwned then return true end
  98. return false
  99. end
  100.  
  101. local GamepassInfo = MS:GetProductInfo(tonumber(b.Name),Enum.InfoType.GamePass)
  102.  
  103. b:WaitForChild("GamepassName").Text = GamepassInfo.Name
  104. b:WaitForChild("GamepassDesc").Text = GamepassInfo.Description
  105. b:WaitForChild("GamepassIcon").Image = "rbxassetid://" .. GamepassInfo.IconImageAssetId
  106.  
  107. b:WaitForChild("PriceFrame"):WaitForChild("GamepassPrice").Text = isOwn(tonumber(b.Name)) and "Owned" or "R$" .. GamepassInfo.PriceInRobux
  108. end
  109.  
  110. ShopHandler:ActivateGamepass()
  111.  
  112. for a,b in pairs(CS:GetTagged("ShopProducts")) do
  113. if not b:IsA("TextButton") then continue end
  114. if not tonumber(b.Name) then b.Visible = false continue end
  115. local ShopProductInfo = MS:GetProductInfo(tonumber(b.Name),Enum.InfoType.Product)
  116.  
  117. local ProdPrice = b:WaitForChild("ProdPrice")
  118.  
  119. ProdPrice.Text = ShopProductInfo.PriceInRobux .. " R$"
  120. end
  121.  
  122. ShopHandler:ActivateShopProducts()
  123.  
  124. end
  125.  
  126. function ShopHandler:ActivateGamepass()
  127. for a,b in pairs(CS:GetTagged(Config.Tags.GamepassButton)) do
  128. if not b:IsA("TextButton") then continue end
  129. if not tonumber(b.Name) then continue end
  130. b.MouseButton1Up:Connect(function()
  131. ShopHandler:PromptGamepass(tonumber(b.Name))
  132. end)
  133. end
  134. end
  135.  
  136. function ShopHandler:ActivateShopProducts()
  137. for a,b in pairs(CS:GetTagged("ShopProducts")) do
  138. if not b:IsA("TextButton") then continue end
  139. if not tonumber(b.Name) then b.Visible = false continue end
  140.  
  141. b.MouseButton1Up:Connect(function()
  142. MS:PromptProductPurchase(LocalPlayer,tonumber(b.Name))
  143. end)
  144. end
  145. end
  146.  
  147. function ShopHandler:PromptGamepass(GamepassId)
  148. if MS:UserOwnsGamePassAsync(LocalPlayer.UserId,GamepassId) then Notify:Notify("You already own this gamepass!") return end
  149. MS:PromptGamePassPurchase(LocalPlayer,GamepassId)
  150. end
  151.  
  152. return ShopHandler
  153.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement