Advertisement
briannovius

Untitled

Nov 1st, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. --SynapseX Decompiler
  2. StoreData = {}
  3. StorePos = Vector3.new(0, 0, 0)
  4. lastClick = 0
  5. lastButton = nil
  6. lastPurchase = 0
  7. function checkPlaceOk()
  8. if game.PlaceId == 198116126 or game.PlaceId == 72740039 then
  9. return true
  10. else
  11. return false
  12. end
  13. end
  14. function CloseOutOfRange()
  15. while wait(0.5) do
  16. if (game.Players.LocalPlayer.Character.Head.Position - StorePos).magnitude > 100 or script.Parent.Store.Visible == false then
  17. script.Parent.Store.Visible = false
  18. break
  19. end
  20. end
  21. end
  22. function Purchase(itemData, p)
  23. if workspace.DistributedGameTime - lastPurchase > 1 then
  24. lastPurchase = workspace.DistributedGameTime
  25. if itemData[6] == 0 then
  26. game.ReplicatedStorage.RemoteFunctionz.Environment.RequestPurchase:FireServer(itemData)
  27. elseif itemData[6] == 1 and game.PlaceId ~= 420777178 then
  28. game.ReplicatedStorage.RemoteFunctionz.Environment.RequestCargoPurchase:FireServer(itemData[1], itemData[3], p)
  29. elseif itemData[6] == 2 and checkPlaceOk() then
  30. game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, itemData[7])
  31. elseif itemData[6] == 3 and checkPlaceOk() then
  32. game:GetService("MarketplaceService"):PromptPurchase(game.Players.LocalPlayer, itemData[7])
  33. elseif itemData[6] == 4 then
  34. game.ReplicatedStorage.RemoteFunctionz.Environment.RequestShipRedeem:FireServer(itemData[1], itemData[3], itemData[4], itemData[5])
  35. else
  36. return
  37. end
  38. end
  39. end
  40. function Clicked(button, desc)
  41. lastButton = button
  42. script.Parent.Store.Frame.ItemName.Text = button.Item_Name.Text
  43. if not string.sub(button.Item_Name.Text, string.len(button.Item_Name.Text)) == ")" and not string.find(button.Item_Name.Text, "100K") and tonumber(button.Quantity.Text) > 1 then
  44. script.Parent.Store.Frame.ItemName.Text = button.Item_Name.Text .. " (x" .. button.Quantity.Text .. ")"
  45. end
  46. script.Parent.Store.Frame.ItemDesc.Text = desc or ""
  47. script.Parent.Store.Frame.Price.Text = button.Price.Text
  48. script.Parent.Store.Frame.Price_Image.Image = button.Price_Image.Image
  49. script.Parent.Store.Frame.Price_Image.Visible = true
  50. script.Parent.Store.Frame.Buy.Visible = true
  51. end
  52. script.Parent.Store.Frame.Buy.MouseButton1Down:connect(function()
  53. Purchase(StoreData[lastButton.StoreIndex.Value], tonumber(lastButton.Price.Text))
  54. end)
  55. script.Parent.OpenStore.Event:connect(function(storeId, storePos)
  56. local storeData = game.ReplicatedStorage.RemoteFunctionz.Environment.GetStoreData:InvokeServer(storeId)
  57. if not storeData then
  58. return
  59. end
  60. StoreData = storeData
  61. StorePos = storePos
  62. script.Parent.Store.Frame.ItemName.Text = ""
  63. script.Parent.Store.Frame.ItemDesc.Text = ""
  64. script.Parent.Store.Frame.Price.Text = ""
  65. script.Parent.Store.Frame.Buy.Visible = false
  66. script.Parent.Store.Frame.Price_Image.Visible = false
  67. local G = script.Parent.Store.ScrollingFrame:GetChildren()
  68. for g = 1, #G do
  69. if G[g].Name ~= "Template" then
  70. G[g]:Destroy()
  71. end
  72. end
  73. local multiplier = 1
  74. if string.find(storeId, "Trader") and game.Players.LocalPlayer.TeamColor == BrickColor.new("Black") then
  75. multiplier = 1.25
  76. end
  77. local nx = 0
  78. local ny = 0
  79. for index, vendor in pairs(storeData) do
  80. do
  81. local b = script.Parent.Store.ScrollingFrame.Template:clone()
  82. b.Name = "V" .. index
  83. b.StoreIndex.Value = index
  84. b.Item_Name.Text = vendor[8]
  85. b.Quantity.Text = vendor[2]
  86. local img = game.ReplicatedStorage.Icons:FindFirstChild(vendor[1])
  87. if vendor[6] == 1 then
  88. img = game.ReplicatedStorage.Icons.Crate
  89. elseif string.find(vendor[1], "Wheel") then
  90. img = game.ReplicatedStorage.Icons.Wheel
  91. elseif string.find(vendor[1], "Figurehead") then
  92. img = game.ReplicatedStorage.Icons.Figurehead
  93. elseif string.find(vendor[1], "Premium Token") then
  94. img = game.ReplicatedStorage.Icons["Premium Token"]
  95. end
  96. img = img or game.ReplicatedStorage.Icons.Missing_Item
  97. b.Item_Image.Image = img.Texture
  98. local img2 = game.ReplicatedStorage.Icons:FindFirstChild(vendor[3])
  99. img2 = img2 or game.ReplicatedStorage.Icons.Missing_Item
  100. b.Price_Image.Image = img2.Texture
  101. b.Price.Text = math.floor(vendor[4] * multiplier)
  102. b.Position = UDim2.new(0, nx * 180 + 5, 0, ny * b.Size.Y.Offset + 5)
  103. b.Parent = script.Parent.Store.ScrollingFrame
  104. b.Visible = true
  105. b.MouseButton1Down:connect(function()
  106. Clicked(b, vendor[9])
  107. end)
  108. nx = nx + 1
  109. if nx > 0 then
  110. ny = ny + 1
  111. nx = 0
  112. end
  113. end
  114. end
  115. script.Parent.Store.ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, ny * script.Parent.Store.ScrollingFrame.Template.Size.Y.Offset)
  116. script.Parent.Store.Visible = true
  117. coroutine.resume(coroutine.create(CloseOutOfRange))
  118. end)
  119. script.Parent.Store.Close.MouseButton1Down:connect(function()
  120. script.Parent.Store.Visible = false
  121. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement